Menu

Layout of loggers

Help
2004-05-06
2004-07-16
  • Andreas Braumann

    Hello there!

    I was wondering how I can accomplish the following (IMHO quite easy) setup of loggers:
    I want all classes to Log every Log message to a file and at the same time on the same level a logger which logs fatal errors to email.
    I couldn't find any example where one could define multiple Appenders for different LOG levels in the same hierarchy level. Is this possible?

     
    • Ritu Kohli

      Ritu Kohli - 2004-06-16

      The answer to your first question is - Yes you can do this by setting a property Threshold for the email appneder to FATAL.
      Something like this:
      log4perl.rootLogger = DEBUG, A1
              log4perl.logger.TestLogger  =  INFO, A1,A2
              log4perl.additivity.TestLogger = 0
              log4perl.appender.A1 = Log::Netcool::SocketProbeAppender
              log4perl.appender.A1.layout = PatternLayout
              log4perl.appender.A1.ProbeHostPrimary =139.149.165.97
              log4perl.appender.A1.ProbePortPrimary = 9898
              log4perl.appender.A1.ProbeHostAlternate = 139.149.165.97
              log4perl.appender.A1.ProbePortAlternate = 9899
              log4perl.appender.A1.ClassID=49900
              log4perl.appender.A1.SAPname=TEST
              log4perl.appender.A1.SAPnumber=003
              log4perl.appender.A1.Stream=IT Test
              log4perl.appender.A1.Region=EU
              log4perl.appender.A1.Location=London 100LS
              log4perl.appender.A1.Environment=TestEnv
              log4perl.appender.A1.Subclass=TestSubclass
              log4perl.appender.A1.Agent=Test Agent
              log4perl.appender.A1.Delay=1
              log4perl.appender.A1.Threshold = FATAL

              log4perl.appender.A2 = Log::Log4perl::Appender::File

       
    • Ritu Kohli

      Ritu Kohli - 2004-06-16

      This is the continuation of the earlier reply.

      log4perl.appender.A2.filename = test.log
      log4perl.appender.A2.mode = 'append'
      log4perl.appender.A2.layout = Log::Log4perl::Layout::SimpleLayout

       
    • Andreas Braumann

      Thanx a lot for the answer!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.