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

This commit is contained in:
Wei Zhou 2020-11-20 11:40:02 +01:00 committed by GitHub
parent daec77f2ef
commit a368ba9def
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View File

@ -1019,10 +1019,6 @@ def main(argv):
# The "GLOBAL" Configuration object # The "GLOBAL" Configuration object
config = CsConfig() config = CsConfig()
logging.basicConfig(filename=config.get_logger(),
level=config.get_level(),
format=config.get_format())
# Load stored ip addresses from disk to CsConfig() # Load stored ip addresses from disk to CsConfig()
config.set_address() config.set_address()

View File

@ -14,3 +14,12 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
import logging
from cs.CsConfig import CsConfig
config = CsConfig()
logging.basicConfig(filename=config.get_logger(),
level=config.get_level(),
format=config.get_format())

View File

@ -26,8 +26,6 @@ import os.path
import configure import configure
import json import json
logging.basicConfig(filename='/var/log/cloud.log', level=logging.INFO, format='%(asctime)s %(filename)s %(funcName)s:%(lineno)d %(message)s')
# first commandline argument should be the file to process # first commandline argument should be the file to process
argc = len(sys.argv) argc = len(sys.argv)
if argc != 2 and argc != 3: if argc != 2 and argc != 3: