Menu

#268 creating custom log level and setting it from prperty file

v1.0.4
closed
None
5
2013-07-14
2012-08-23
Anonymous
No

Hello,
I am trying to create custom log levels but I have faced these problems:
1. I am not able to set custom log level from property file, log4cplus crashes (Getting error: log4cplus:ERROR LoggerImpl::getChainedLogLevel()- No valid LogLevel found);
2. If I set custom log level in my program, then log level in log file is named: UNKNOWN;

Info about log4cplus:
Using static library
Version - 1.0.4
Build system - VisualStudio 2010 (project configuration is Debug)
Windows 7 SP1, 64bit

Config file:
log4cplus.rootLogger=TRACE1, Main

log4cplus.appender.Main=log4cplus::RollingFileAppender
log4cplus.appender.Main.File=myLogFile.log
log4cplus.appender.Main.Append=true
log4cplus.appender.Main.MaxFileSize=10MB
log4cplus.appender.Main.MaxBackupIndex=50
log4cplus.appender.Main.layout=log4cplus::PatternLayout
log4cplus.appender.Main.layout.ConversionPattern=%d | [%-7p] | %-20c | %-20m |%n

Discussion

  • Anonymous

    Anonymous - 2012-08-23

    sources how I have created custom log level

     
  • Václav Haisman

    Václav Haisman - 2012-08-26
    • assigned_to: nobody --> wilx
     
  • Václav Haisman

    Václav Haisman - 2012-08-27
    • status: open --> pending
     
  • Václav Haisman

    Václav Haisman - 2012-08-27

    I could not reproduce the problem with log4cplus' test cases. But these test cases are using log4cplus as a DLL. Could you try your code with log4cplus as a DLL? Also/alternatively, could you test with the pushToStringMethod() and pushFromStringMethod() calls moved into main()? I suspect this might be an instance of static objects initialization order fiasco problem.

     
  • Anonymous

    Anonymous - 2012-08-28

    I will try your suggestions next week.
    Also I have noticed if log level is misspelled, then log4cplus (static library) crashes with the same error as I have wrote earlier.
    Thanks for suggestions.

     
  • Anonymous

    Anonymous - 2012-09-06

    You were right about initialization order problem. When I moved calls you specified to main it worked great. I tested on static library.
    Thanks for help.

     
  • Václav Haisman

    Václav Haisman - 2013-07-14

    Ticket moved from /p/log4cplus/support-requests/32/

     

Log in to post a comment.

Auth0 Logo