2

I have defined a logger as follows:

logger = logging.getLogger('APP')
syslog = logging.StreamHandler()
formatter = logging.Formatter('%(app_name)s : %(message)s')
app_name = {'app_name':'MULE'}
syslog.setFormatter(formatter)
logger.addHandler(syslog)
logger = logging.LoggerAdapter(logger, app_name)

I am trying to prepend a string to every logger message. I have added this code based on this question and other similar questions. The problem is that now the logger is printing out 2 statements for every output that I want. The output is as follows:

[03/Dec/2015 12:05:59] INFO views 91 1399960 [APP:1075] Picked
MULE : Picked

Why is this happening? Where am I going wrong?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.