Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add logging to file -- Include changes for Pull Request #563 in v300 branch #569

Merged
merged 4 commits into from
Apr 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions config/setupcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
from hpedockerplugin import configuration as conf
from hpedockerplugin.hpe import hpe3par_opts as plugin_opts
from oslo_log import log as logging
import logging as log
from oslo_config import cfg
from logging.handlers import RotatingFileHandler

host_opts = [
cfg.StrOpt('hpedockerplugin_driver',
Expand Down Expand Up @@ -72,6 +74,16 @@ def setup_logging(name, level):
logging.setup(CONF, name)
LOG = logging.getLogger(None)

# Add option to do Log Rotation
handler = RotatingFileHandler('/etc/hpedockerplugin/3pardcv.log',
maxBytes=10000000, backupCount=100)
formatter = log.Formatter('%(asctime)-12s [%(levelname)s] '
'%(name)s [%(thread)d] '
'%(threadName)s %(message)s')

handler.setFormatter(formatter)
LOG.logger.addHandler(handler)

if level == 'INFO':
LOG.logger.setLevel(logging.INFO)
if level == 'DEBUG':
Expand Down