1

Following is my sample log4cxx configuration file which I use in my project -

# Set root logger level to INFO and its only appender to A1.
log4j.rootLogger=INFO, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{yy-MM-dd HH:mm:ss.SSS} %X{pname}:%X{pid} %-5p %l- %m%n
log4j.appender.A1.serverFileAppender=org.apache.log4j.RollingFileAppender

# Tweak the timestamp format so that it sorts easier
log4j.appender.A1.serverFileAppender.fileName=/tmp/client_cpp.log

Currently, the rootLogger is set to INFO. Is there a way to configure it such that it only logs DEBUG messages in certain .cpp files? For example, I have a Consumer.cpp file which has a few log messages with DEBUG level. How can I configure it so that it only logs DEBUG messages from that file? I went through the tutorial here, but didn't file the relevant information.

Onkar Deshpande
  • 301
  • 4
  • 15

1 Answers1

0

I solved this by adding following line in the log4cxx.conf file -

log4j.category.ProducerImpl=DEBUG
Onkar Deshpande
  • 301
  • 4
  • 15