Skip to content

VR: fix logging is not working and logs are not appended to /var/log/cloud.log#4466

Merged
DaanHoogland merged 3 commits into
apache:4.14from
ustcweizhou:4.14-fix-vr-logging
Nov 20, 2020
Merged

VR: fix logging is not working and logs are not appended to /var/log/cloud.log#4466
DaanHoogland merged 3 commits into
apache:4.14from
ustcweizhou:4.14-fix-vr-logging

Conversation

@ustcweizhou
Copy link
Copy Markdown
Contributor

Description

There are no logs in /var/log/cloud.log when something are changed in VRs (for example start vms, add/remove rules).

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):

How Has This Been Tested?

@DaanHoogland
Copy link
Copy Markdown
Contributor

code looks good @weizhouapache . Are we to understand that any modules imported don't get the changed logging config if it is set after importing?

@weizhouapache
Copy link
Copy Markdown
Member

code looks good @weizhouapache . Are we to understand that any modules imported don't get the changed logging config if it is set after importing?

@DaanHoogland yes. actually all python scripts in /opt/cloud/bin/cs does not have logging settings, so there is no log appended to /var/log/cloud.log
update_config.py is the entry to update VR configurations (including iptables rules/nics/configs,etc).
we have similar code in elder versions which work fine. After systemvm refactoring by @rhtyd , it does not work any more. I have no idea what caused it.

@yadvr yadvr added this to the 4.14.1.0 milestone Nov 18, 2020
@yadvr
Copy link
Copy Markdown
Member

yadvr commented Nov 18, 2020

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@DaanHoogland
Copy link
Copy Markdown
Contributor

pylint doesn't approve of this, @weizhouapache @rhtyd (see 1st travis job) maybe we can mashup the order some more

Comment on lines +19 to +21
import logging
logging.basicConfig(filename='/var/log/cloud.log', level=logging.INFO, format='%(asctime)s %(filename)s %(funcName)s:%(lineno)d %(message)s')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really helpfull, maybe. we can solve the pylint issue by tickering the order, something like:

Suggested change
import logging
logging.basicConfig(filename='/var/log/cloud.log', level=logging.INFO, format='%(asctime)s %(filename)s %(funcName)s:%(lineno)d %(message)s')
import sys
import logging
import subprocess
import os
import os.path
import configure
import json
logging.basicConfig(filename='/var/log/cloud.log', level=logging.INFO, format='%(asctime)s %(filename)s %(funcName)s:%(lineno)d %(message)s')
from subprocess import PIPE, STDOUT

Maybe with more from x import y's. Or have some option on pylint.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔centos7 ✖centos8 ✔debian. JID-2397

…appended to /var/log/cloud.log"

This reverts commit 843a380a923fc91e717440f7af910b3d8933de9f.
@weizhouapache
Copy link
Copy Markdown
Member

pylint doesn't approve of this, @weizhouapache @rhtyd (see 1st travis job) maybe we can mashup the order some more

@DaanHoogland @rhtyd found another fix, tested ok. please review and test it

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Nov 18, 2020

@blueorangutan package

Copy link
Copy Markdown
Member

@yadvr yadvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, but needs checking if we need to specify explicit log file path

@blueorangutan
Copy link
Copy Markdown

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔centos7 ✖centos8 ✔debian. JID-2403

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Nov 19, 2020

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@DaanHoogland
Copy link
Copy Markdown
Contributor

great @weizhouapache more elegant and the travis errors so far are unrelated. it's easy to overlook the package init possibility, thanks for this.

@blueorangutan
Copy link
Copy Markdown

Trillian test result (tid-3206)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 31599 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4466-t3206-kvm-centos7.zip
Smoke tests completed. 83 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

@DaanHoogland
Copy link
Copy Markdown
Contributor

marking this as major as it stops operators from being able to do proper diagnosis on the system/network

Copy link
Copy Markdown
Contributor

@davidjumani davidjumani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Able to see logs when rules added

Screenshot from 2020-11-20 14-53-01

@DaanHoogland DaanHoogland merged commit a368ba9 into apache:4.14 Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants