Bug 1184523 - [abrt] fedmsg-hub: config.py:627:configure:ValueError: Unable to configure logger 'fedmsg': Unable to add handler 'filelog': 'filelog'
Summary: [abrt] fedmsg-hub: config.py:627:configure:ValueError: Unable to configure lo...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: fedmsg
Version: rawhide
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ralph Bean
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:4a517f946d8490324e24ef29630...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-21 15:39 UTC by Valeri Rangelov
Modified: 2015-01-21 19:02 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-01-21 19:02:39 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: backtrace (2.22 KB, text/plain)
2015-01-21 15:39 UTC, Valeri Rangelov
no flags Details
File: dso_list (59 bytes, text/plain)
2015-01-21 15:39 UTC, Valeri Rangelov
no flags Details
File: environ (2.63 KB, text/plain)
2015-01-21 15:39 UTC, Valeri Rangelov
no flags Details

Description Valeri Rangelov 2015-01-21 15:39:18 UTC
Description of problem:
Follow this steps from:
https://bitbucket.org/fedoraqa/taskotron-trigger/overview


In /etc/fedmsg.d/logging, add the following handler:

filelog={
  "class": "logging.handlers.RotatingFileHandler",
  "formatter": "bare",
  "level": "INFO",
  "filename": "/var/log/fedmsg/taskotron-trigger.log",
  "mode": "a",
}

Then replace the console handler with the filelog handler for the fedmsg logger so that log messages are sent to a separate file instead of to the console:

fedmsg={
  "level": "INFO",
  "propagate": False,
- "handlers": ["console"],
+ "handlers": ["filelog"],
},


And after this changes I type in console this command:
fedmsg-hub


Version-Release number of selected component:
fedmsg-hub-0.11.1-1.fc22

Additional info:
reporter:       libreport-2.3.0
cmdline:        /usr/bin/python /usr/bin/fedmsg-hub
executable:     /usr/bin/fedmsg-hub
kernel:         3.17.8-300.fc21.x86_64
runlevel:       N 5
type:           Python
uid:            0

Truncated backtrace:
config.py:627:configure:ValueError: Unable to configure logger 'fedmsg': Unable to add handler 'filelog': 'filelog'

Traceback (most recent call last):
  File "/usr/bin/fedmsg-hub", line 9, in <module>
    load_entry_point('fedmsg==0.11.1', 'console_scripts', 'fedmsg-hub')()
  File "/usr/lib/python2.7/site-packages/fedmsg/commands/hub.py", line 91, in hub
    command = HubCommand()
  File "/usr/lib/python2.7/site-packages/fedmsg/commands/__init__.py", line 54, in __init__
    dictConfig(self.config.get('logging', {'version': 1}))
  File "/usr/lib64/python2.7/logging/config.py", line 794, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib64/python2.7/logging/config.py", line 627, in configure
    '%r: %s' % (name, e))
ValueError: Unable to configure logger 'fedmsg': Unable to add handler 'filelog': 'filelog'

Local variables in innermost frame:
loggers: {'fedmsg': {'level': 'INFO', 'propagate': False, 'handlers': ['filelog']}, 'moksha': {'handlers': ['console'], 'propagate': False, 'level': 'INFO'}}
disable_existing: True
e: ValueError("Unable to add handler 'filelog': 'filelog'",)
name: 'fedmsg'
pflen: 7
prefixed: 'fedmsg.'
i: 4
config: {'loggers': {'fedmsg': {'level': 'INFO', 'propagate': False, 'handlers': ['filelog']}, 'moksha': {'handlers': ['console'], 'propagate': False, 'level': 'INFO'}}, 'version': 1, 'formatters': {'bare': <logging.Formatter object at 0x7fbdf84920d0>}, 'filters': {}, 'handlers': {'console': <logging.StreamHandler object at 0x7fbdf842f2d0>}}
EMPTY_DICT: {}
handlers: {'console': <logging.StreamHandler object at 0x7fbdf842f2d0>}
incremental: False
child_loggers: ['fedmsg.crypto', 'fedmsg.crypto.gpg', 'fedmsg.crypto.x509']
existing: ['fedmsg.crypto', 'fedmsg.crypto.gpg', 'fedmsg.crypto.x509', 'requests', 'requests.packages', 'requests.packages.urllib3', 'requests.packages.urllib3.connectionpool', 'requests.packages.urllib3.poolmanager', 'requests.packages.urllib3.util', 'requests.packages.urllib3.util.retry']
num_existing: 11
deferred: []
handler: <logging.StreamHandler object at 0x7fbdf842f2d0>
filters: {}
formatters: {'bare': <logging.Formatter object at 0x7fbdf84920d0>}
root: <logging.RootLogger object at 0x7fbdf9403e90>
self: <logging.config.DictConfigurator object at 0x7fbdf8426fd0>

Comment 1 Valeri Rangelov 2015-01-21 15:39:21 UTC
Created attachment 982376 [details]
File: backtrace

Comment 2 Valeri Rangelov 2015-01-21 15:39:22 UTC
Created attachment 982377 [details]
File: dso_list

Comment 3 Valeri Rangelov 2015-01-21 15:39:23 UTC
Created attachment 982378 [details]
File: environ

Comment 4 Ralph Bean 2015-01-21 16:13:55 UTC
Can you attach the entire contents of your /etc/fedmsg.d/logging.py file?

Comment 5 Valeri Rangelov 2015-01-21 16:37:43 UTC
(In reply to Ralph Bean from comment #4)
> Can you attach the entire contents of your /etc/fedmsg.d/logging.py file?

bare_format = "[%(asctime)s][%(name)10s %(levelname)7s] %(message)s"



config = dict(
    logging=dict(
        version=1,
        formatters=dict(
            bare={
               	"datefmt": "%Y-%m-%d %H:%M:%S",
               	"format": bare_format
            },
        ),
        handlers=dict(
            console={
                "class": "logging.StreamHandler",
               	"formatter": "bare",
               	"level": "INFO",
               	"stream": "ext://sys.stdout",
            }
            filelog={
               "class": "logging.handlers.RotatingFileHandler",
               "formatter": "bare",
               "level": "INFO",
               "filename": "/var/log/fedmsg/taskotron-trigger.log",
               "mode": "a",
}

       	),
       	loggers=dict(
            fedmsg={
               	"level": "INFO",
               	"propagate": False,
               	"handlers": ["filelog"],
            },

    moksha={
                "level": "INFO",
                "propagate": False,
                "handlers": ["console"],
            },
        ),
    ),
)

Comment 6 Ralph Bean 2015-01-21 17:05:41 UTC
Looks like you need a comma after the closing brace before filelog.  Like this:


               	"stream": "ext://sys.stdout",
            },
            filelog={
               "class": "logging.handlers.RotatingFileHandler",

Comment 7 Valeri Rangelov 2015-01-21 18:14:13 UTC
That resolve the problem. Thank you.

Comment 8 Ralph Bean 2015-01-21 19:02:39 UTC
Glad to help.  :)


Note You need to log in before you can comment on or make changes to this bug.