Log4j appender question

I need some log4j help. Hope anyone can help me.
Question 1:
I need to log information to 4 different files. As far as I can tell from the log4j docs, I will then need to create 4 different appenders in the log4j.properties file. How can I do that?
Looking at examples, it looks like I will need to add 4 new sections similar to this one. Is that correct?
# Logfile 1
log4j.appender.log1=org.apache.log4j.RollingFileAppender
log4j.appender.log1.File=C:/Sun/logs/logme1.log
Question 2:
After that is done, how can I actually write to the files? When logging I was thinking just using: logger.info("log something").
How can I specify which file that will log to? Is that even the correct way to log?
Hope someone can help!

After that is done, how can I actually write to the files? When logging I
was thinking just using: logger.info("log something").
How can I specify which file that will log to? Is that even the correct
way to log?apperantly, it doesn't seem like you have understand how log4j works. that's probably why warnerja tell you to perform some search.
understand the technology first..then ask specific question here.
it will be useless just handling out answers to everyone. i think they're here just not to provides answers, but to educate other along the way...but they need to see an effort was made first.
you're right..there are time when one doesn't have enough time to understand the whole technology..or the technology is too difficult to comprehend..or the documentation is poor., but i think there are plenty of good documentation on log4j. Futhermore..what you are asking is not usually shown in the documentation, but a google search would probably provides you with the answer you seek..you just need to find a good keyword.
Futhermore, I suggest you read some tutorial on log4j if you plan to use the technology..it will not takes all day..maybe an hour or so..just to get how the technology works
anyway,
your appender tell the logger where the log the message to (depends on the level you specified) .. so if you have 3 appender that specified
the level to be INFO, and you have logger.info("This is an INFO message"), then the message will be log to all three files.
log4j.threshold=ALL
log4j.rootLogger=ALL, stdout, DebugAppender, InfoAppender,
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%n
log4j.logger.DebugAppender.access=DEBUG
log4j.appender.DebugAppender=org.apache.log4j.RollingFileAppender
log4j.appender.DebugAppender.File=.${file.separator}log${file.separator}ex_debug.log
log4j.appender.DebugAppender.MaxFileSize=10KB
log4j.appender.DebugAppender.MaxBackupIndex=1
log4j.appender.DebugAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.DebugAppender.layout.ConversionPattern=%c %d{ISO8601} -- %p --
%m%n
log4j.logger.InfoAppender.access=INFO
log4j.appender.InfoAppender=org.apache.log4j.RollingFileAppender
log4j.appender.InfoAppender.File=.${file.separator}log${file.separator}ex_info.log
log4j.appender.InfoAppender.MaxFileSize=10MB
log4j.appender.InfoAppender.MaxBackupIndex=2
log4j.appender.InfoAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.InfoAppender.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%nthe
log4j.rootLogger=
tell what appender to use...so include all your appender in this property.
you appender specified the logging level INFO, WARN, DEBUG,
ERROR, or FATAL. I'm not sure how to specified the min and max level
for an appender using a property file..for xml configuartion file..look at
the example provide in previous reply.
now if you do :
logger.info("This is an info message") and want it to log to file1 and file2
and log.info("This is another info message") and you want this to log to file3
you can't do that...a way around this is to create your own level..and the
appender will specifies that level.
if you plan to use an XML configuration file, then make sure you include the <root> node
<root>
   <priority value="debug"/>
   <appender-ref ref="DEBUG"/> 
   <appender-ref ref="INFO"/>
   <appender-ref ref="MY_APPENDER_NAME"/>
</root>
</log4j:Configuration>

Similar Messages

  • LOG4J Appender  to Webservices

    Hello,
    I have a question.
    Is there an LOG4J Appender to Webservices?
    I founded a lot of kinds of appenders on www.apache.org, but nothing about webservices.
    Thanks for any help!!

    Thanks. I'm using a startup class. I could easily check if log4j is in the server classpath, and attach my appender. However, if log4j is not in server classpath, and in the application classpath, I need to check for this. I was using ApplicationContainerFactory in weblogic 8 like so:
    appContainerFactory.getApplicationContainer(applicationName).getApplicationClassLoader()
    which is not available in weblogic 9. And I can't find in the docs anywhere to indicate it's replacement, or any type of alternative.

  • Reassign stderr/stdout to a Log4J appender.

    Does anyone know if there is a 'quick-and-dirty' way to reassign Java stderr and stdout to a Log4J Appender? Both Google and the log4j mailing lists are pretty sparse on this subject...

    This is the dirty way of doing it. If anyone knows
    the better way please mention it here.This is just putting a band-aid on a wound which will not be cured by a band-aid. It only masks the problem, and may introduce further problems (such as: What if you actually don't want to "log" certain things that were only intended for System.out?)
    The better way would be to re-design the code so that it logs messages to loggers rather than writing to System.out.
    I suspect the OP and you both know that, but just pointing it out in case.

  • Log4j, appender and InstantiationException

    Hi,
    I have written my own appender in an Eclipse project that uses log4j. When I try to use the appender I get the following exception:
    log4j:ERROR Could not instantiate class [test.appender.NewFileAppender].
    java.lang.InstantiationException: test.appender.NewFileAppender
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:329)
         at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:120)
         at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:629)
         at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
         at org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:533)
         at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:417)
         at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:316)
         at org.apache.log4j.PropertyWatchdog.doOnChange(PropertyConfigurator.java:682)
         at org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:88)
         at org.apache.log4j.helpers.FileWatchdog.<init>(FileWatchdog.java:57)
         at org.apache.log4j.PropertyWatchdog.<init>(PropertyConfigurator.java:674)
         at org.apache.log4j.PropertyConfigurator.configureAndWatch(PropertyConfigurator.java:382)
         at se.micronic.argos.main.Main.initLogging(Main.java:305)
         at se.micronic.argos.main.Main.<init>(Main.java:272)
         at se.micronic.argos.main.Main.main(Main.java:1339)
    log4j:ERROR Could not instantiate appender named "argos".My property file looks like this:
    log4j.appender.argos=test.appender.NewFileAppender
    log4j.appender.argos.file=logs/MArgos.logThe other appenders in the property file work fine.
    Any ideas?
    Thanks
    Markus

    could be you don't have a no-args constructor? show us the NewFileAppender class
    is that the entire stack trace? there's no other underlying exception being thrown?

  • Digital signature/appending question

    Got a question for y'all. I work with a medical practice who just started using Acrobat 9 to affix digital signatures to their documents. Using Acrobat, they've created a page that can be filled in with information about a patient, and then digitally signed by the doctor.
    Here's the thing. We just got done scanning all of the patient charts for this practice and converting then to PDFs. So now, all the charts are electronic. Each chart is divided into seperate tabs (Patient Info, Treatment Plan, etc.). After a doctor fills out the page they've created and then digitally signs it, we would then like to save it and then append it to the corresponding tab in that patient's chart (in this case, Pateint Info). Using Acrobat, filling it out, signing it and saving it is no problm, it's when we append it that the problem surfaces.
    After it's appended, the signature goes away! What can we do about this? Obviously, we don't want that signature going anywhere. Any ideas? Please help, we'd like to get this solved ASAP!

    Thanks for the link! However, there is something new that has recently arisen:
    Every time a patient comes into the office for an appointment, a new page is added to certain parts of the chart (such as Progress Notes) detailing their last visit. Now that all the charts are electronic, this can be done on a computer. So, for a section like, say, Progress Notes, there's all the old charts organized with the most recent one on top. However, that's not the very first page-the very first page is a blank progress note, ready for the patient's next visit.
    All they want to be able to do when they fill out a chart is, after it's saved, have it go on top of the chart (as it's now the most recent page) and have a new blank page appear, ready for the next visit. It's like inserting a blank page, but they don't want to do that-they simply want a new blank page to appear and move to the front on top of the most recent page.
    Does this make sense? I really could use some help ASAP!

  • Regsitering log4j appender to a logger in a class in a web app

    During weblogic 9.2 server startup I would like to register a Handler with any number of log4j Loggers in all deployed web apps. I was thinking I could somehow get a reference to the applications classloader, and see if it has log4j, then register with the root logger. I used to do this in WLS 8, using ApplicationContainerFactory, but this is no longer available in WLS 9. Is there another way to do this in WLS 9? Thank for any help.

    Thanks. I'm using a startup class. I could easily check if log4j is in the server classpath, and attach my appender. However, if log4j is not in server classpath, and in the application classpath, I need to check for this. I was using ApplicationContainerFactory in weblogic 8 like so:
    appContainerFactory.getApplicationContainer(applicationName).getApplicationClassLoader()
    which is not available in weblogic 9. And I can't find in the docs anywhere to indicate it's replacement, or any type of alternative.

  • JMX-Log4j Appender problem

    Dear listers
    we wrote thefollowing code to log the loglevel's dynamically.
    Following is the code
    public class MyApp implements MyAppMBean {     
    private static Logger logger = Logger.getLogger(MyApp.class);
    public void go() throws Exception{
    while(true){
    logger.debug("DEBUG") ;
    logger.info("INFO") ;
    logger.warn("WARN");
    logger.error("ERROR");
    logger.fatal("FATAL");
    Thread.sleep(2000);
    public void setLoggingLevel(String level){
    logger.info("Setting logging level to: " + level);
    Level newLevel = Level.toLevel(level, Level.INFO);
    Logger.getRootLogger().setLevel(newLevel);
    public String getLoggingLevel(){                       
    return Logger.getRootLogger().getLevel().toString() ;
    public static void main(String[] args) throws Exception
    DOMConfigurator.configure("log4j.xml");
    MyApp app = new MyApp();
    //Lookup for the mbean server
    MBeanServer server = ManagementFactory.getPlatformMBeanServer();
    //Create and register the top level log4j MBean
    HierarchyDynamicMBean hdm = new HierarchyDynamicMBean();
    ObjectName mbo = new ObjectName("log4j:logger=root");
    System.out.println("Debug10");
    server.registerMBean(hdm, mbo);
    LoggerRepository r = LogManager.getLoggerRepository();
    Enumeration<Logger> elogs = r.getCurrentLoggers();
    Logger logger = null;
    while(elogs.hasMoreElements())
    //need to show the elements of teamcenter only.
    logger = (Logger)elogs.nextElement();
    hdm.addLoggerMBean(logger.getName());
    } System.out.println(Logger.getRootLogger().getLevel().toString());
    int portNumber=9999;
    ObjectName htmlName = new ObjectName("log4j:logger=root,port=" + portNumber) ;
    HtmlAdaptorServer html = new HtmlAdaptorServer(portNumber);
    html.setPort(portNumber);
    server.registerMBean(html, htmlName);
    html.start();
    app.go();
    When setting the attributes for the appenders under log4j from htmladapter it gives the following message.
    *477 All Attributes Not Set*
    *1/8 attribute(s) were not set:*
    appender%3DTaskAppender%2Clayout%3Dorg.apache.log4j.PatternLayout
    Please advice how can we solve this issue ~Vilas

    Dear listers
    we wrote thefollowing code to log the loglevel's dynamically.
    Following is the code
    public class MyApp implements MyAppMBean {     
    private static Logger logger = Logger.getLogger(MyApp.class);
    public void go() throws Exception{
    while(true){
    logger.debug("DEBUG") ;
    logger.info("INFO") ;
    logger.warn("WARN");
    logger.error("ERROR");
    logger.fatal("FATAL");
    Thread.sleep(2000);
    public void setLoggingLevel(String level){
    logger.info("Setting logging level to: " + level);
    Level newLevel = Level.toLevel(level, Level.INFO);
    Logger.getRootLogger().setLevel(newLevel);
    public String getLoggingLevel(){                       
    return Logger.getRootLogger().getLevel().toString() ;
    public static void main(String[] args) throws Exception
    DOMConfigurator.configure("log4j.xml");
    MyApp app = new MyApp();
    //Lookup for the mbean server
    MBeanServer server = ManagementFactory.getPlatformMBeanServer();
    //Create and register the top level log4j MBean
    HierarchyDynamicMBean hdm = new HierarchyDynamicMBean();
    ObjectName mbo = new ObjectName("log4j:logger=root");
    System.out.println("Debug10");
    server.registerMBean(hdm, mbo);
    LoggerRepository r = LogManager.getLoggerRepository();
    Enumeration<Logger> elogs = r.getCurrentLoggers();
    Logger logger = null;
    while(elogs.hasMoreElements())
    //need to show the elements of teamcenter only.
    logger = (Logger)elogs.nextElement();
    hdm.addLoggerMBean(logger.getName());
    } System.out.println(Logger.getRootLogger().getLevel().toString());
    int portNumber=9999;
    ObjectName htmlName = new ObjectName("log4j:logger=root,port=" + portNumber) ;
    HtmlAdaptorServer html = new HtmlAdaptorServer(portNumber);
    html.setPort(portNumber);
    server.registerMBean(html, htmlName);
    html.start();
    app.go();
    When setting the attributes for the appenders under log4j from htmladapter it gives the following message.
    *477 All Attributes Not Set*
    *1/8 attribute(s) were not set:*
    appender%3DTaskAppender%2Clayout%3Dorg.apache.log4j.PatternLayout
    Please advice how can we solve this issue ~Vilas

  • Log4j appender

    hi,
    i have requirement wherein i must have logs generated for each 100 Mb but the rollover must not happen based on teh index. it must happen every 6 hours.
    so the logs must be generated as ,
    logging.log
    logging.log.1
    logging.log.2
    logging.log.3
    logging.log.15
    and after 6 hours, the rollover must start again.
    i am new to log4j, i want somebody to give some input or any pointerw where i can learn to do this sooner will be appreciated..
    thanks,
    aravind

    I seem to remember that someone contributed a TimeAndSizeRollingAppender to the Apache project. hava a google for it. ;-)

  • Log4j appender pipelining

    Hi there,
    Can I pipeline log4j appenders? Essentially, I have a custom AsyncAppender which I want feeding into DailyRollingFileAppender for file rollover purposes.
    How can I do that?
    Kind Regards,
    Zalle

    Hi there,
    Can I pipeline log4j appenders? Essentially, I have a custom AsyncAppender which I want feeding into DailyRollingFileAppender for file rollover purposes.
    How can I do that?
    Kind Regards,
    Zalle

  • Append Questions to a Survey Dynamically

    Hi everyone, I have the requirement of create a survey on the fly and then attach this survey to an order !? the questions are in many different surveys and this new one survey must have sections of many of them, I´m new working with surveys.  I found the survey suite but i don´t think this can be done with this. Any help will be appreciated !
    Edited by: Isaac Mena on Sep 9, 2011 7:01 PM

    Hi mena,
    We implement same dynamic display of survey  with the help of Portal (JAVA WEBDYNPRO).
    WE asked  java webdynpro developer to build an application which receives list of table questions and answers and display them accordingly.
    once he done with development we integrated the same to crm via transaction launcher.
    Complexities in this approach are
    1.You should maintain custom tables which stores and updates when ever survey created and changed ( Use WEBUI as source to  update surveys and webui developer write a code to trabslate content of survey into custom table)
    2.sending teh table content via transaction launcher.

  • Log4j question about closed appender error

    Hi all,
    In my company's project, we have used the log4j 1.1.3 for logging. Since in the project, there are a few applications. We have a common properties to state the log4j properties for AppSTDERR(console), AppLogFile and AppNTEventLog. And we also have a properties file for each application. In each proeprties file, we state a different path to the AppLogFile for different application. We use PropertyConfigurator.configure() to configure the properties and use Category.getRoot(). However, sometimes some application's log will log to another application log file. So we decide to change the application properties file like this:
    log4j.category.AppXXX=DEBUG, AppXXXSTDERR, AppXXXLogFile
    log4j.appender.AppXXXLogFile=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.AppXXXLogFile.File=C:\\xxx\\xxx.log
    log4j.appender.AppXXXLogFile.layout=org.apache.log4j.PatternLayout
    log4j.appender.AppXXXLogFile.layout.ConversionPattern=%d{ISO8601} [%-5p] [%t] %m%n
    log4j.appender.AppXXXSTDERR: org.apache.log4j.ConsoleAppender
    log4j.appender.AppXXXSTDERR.layout: org.apache.log4j.PatternLayout
    log4j.appender.AppXXXSTDERR.layout.ConversionPattern: %d{ISO8601} [%-5p] [%t] - %m%n
    We don't use Category.getRoot() and use Category.getInstance("AppXXX") instead. But we sometimes get these errors on console:
    log4j:ERROR Attempted to append to closed appender named [AppSTDERR].
    log4j:WARN Not allowed to write to a closed appender.
    log4j:ERROR Attempted to append to closed appender named [AppLogFile].
    log4j:WARN Not allowed to write to a closed appender.
    We don't know what is the problem. We guess that some common programs will log common messages to AppLogFile and AppSTDERR but we do not open the AppLogFile and AppSTDERR in each application. Is that we have to use Category.getRoot() ?
    Anybody help?
    Raymond

    Do you not need a DatePattern value for the DailyRollingFileAppender? DatePattern being the variable that determines WHEN the logs are rolled.
    If not specified what is the default value? Could not setting this value result in strange behavior?
    These are shots in the dark I know but we are having similar issues. I can't find any documentation on what the default value is of DatePattern if not specified and have no idea what happens if no value is set. At any rate we are going to supply a value for DatePattern and see if it fixes our problem, I'll post the resutls.

  • Log4J Asynchronous appender

    hi
    any one can help me how can i use " Log4J Asynchronous appender" in my project.
    cureently i am using Log4J appender for logging using the property files

    Your question is a bit hard to understand, but if you mean you have the configuration of Log4J in property files today (using PropertyConfigurator) there is no way to use the AsyncAppender.
    The AsynAppender ( [http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/AsyncAppender.html] ) requires xml configuration (DOMConfigurator):
    Important note: The AsyncAppender can only be script configured using the DOMConfigurator. - Roy

  • Log4j is not picking up an appender

    I configured a logger "mailLogger" in the properties file, and I defined an appender "mail".
    In the code, I get the logger by name, and list all the appenders.
    It tells me there are no appenders.
    Shouldn't the "mail" appender be added by putting it in log4j.properties?
    My log4j properties file:
    log4j.rootLogger=INFO, xmlout
    log4j.logger.mailLogger=ALL, mail
    log4j.appender.xmlout=biz.minaret.log4j.DatedFileAppender
    log4j.appender.xmlout.threshold=DEBUG
    log4j.appender.xmlout.Directory=/app/usrlogs
    log4j.appender.xmlout.Prefix=sfgpo.
    log4j.appender.xmlout.Suffix=.log
    log4j.appender.xmlout.Append=true
    log4j.appender.xmlout.layout=org.apache.log4j.xml.XMLLayout
    log4j.appender.mail=org.apache.log4j.net.SMTPAppender
    log4j.appender.mail.To=[email protected]
    log4j.appender.mail.From="SFG Application Mailer"
    log4j.appender.mail.SMTPHost=myhost.myorg.com
    log4j.appender.mail.Threshold=ERROR
    log4j.appender.mail.BufferSize=1
    log4j.appender.mail.Subject=SFG PO event notice
    log4j.appender.mail.layout=com.moodys.sfg.utility.logger.MoodysHTMLLayout
    log4j.additivity.mailLogger=true
    log4j.appender.mail.layout.LocationInfo=true
    My java code:
    import java.util.Enumeration;
    import org.apache.log4j.Appender;
    import org.apache.log4j.Logger;
    import org.apache.log4j.net.SMTPAppender;
    Logger logger = Logger.getLogger("mailLogger");
    Enumeration en = logger.getAllAppenders();
    System.out.println("Listing all appenders for the logger");
    while (en.hasMoreElements())
         Appender a = (Appender)en.nextElement();
         String apName = a.getName();
         System.out.println(" Appender: name = " + apName);
    System.out.println("End of appender list");
    The console output is:
    Llisting all appenders for the logger
    End of appender list
    Why does it not find my appender "mail"?
    Thanks in advance.
    Elliot

    Hi Elliot.
    I had the same trouble and I resolved when I commented out the "rootLogger line", as follow below:
    # disabling line
    # log4j.rootLogger=INFO, xmlout
    I hope that helps you.
    Gui Pereira.

  • Want to append time stamp to file name in log4j property

    Hi
    I want to append the timestamp to name of log file.
    here i am attaching my sample log4j.property file
    plase heple me for correct syntax
    log4j.logger.bar=DEBUG, dest1
    log4j.appender.dest1=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
    log4j.appender.dest1.file=log.log
    #log4j.appender.dest1.append=true
    log4j.appender.dest1.datePattern='.'yyyyMMdd
    log4j.appender.dest1.layout.ConversionPattern= %d{dd-MMM-yyyy HH:mm:ss aaa} [%3p] %n%m%n%n
    log4j.appender.dest1.encoding=UTF-8
    log4j.logger.foo=DEBUG, A2
    log4j.appender.A2=org.apache.log4j.RollingFileAppender
    log4j.appender.A2.layout=org.apache.log4j.PatternLayout
    log4j.appender.A2.File=example1.{timestamp}.log
    #log4j.appender.A2.append=true
    log4j.appender.A2.layout.ConversionPattern= %d{dd-MMM-yyyy HH:mm:ss aaa} [%3p] %n%m%n%n
    #log4j.appender.A2.datePattern='.'yyyyMMdd
    log4j.appender.A2.encoding=UTF-8

    Is your google broken?
    http://www.google.com/search?q=log4j+timestamp+syntax+examples

  • Log4j file appender

    Hi,
    I am using log4j for logging. I am working on a huge application and there would be lots of logs each day. Thereby it is requried that the log files be stored and renamed each day. The date is appended to the log file and that day's log file is stored. The logs start writing afresh each day. The problem here is that at times the application simply starts logging to the previous day's log file, for a while, and then starts writing back to the current day's file again. I am not able to figure out what goes wrong and when. The application is running on weblogic. Can anybody please help? The log4j properties file is here....
    # DO NOT MODIFY
    log4j.categoryFactory=com.myapp.util.logger.LoggerCategoryFactory
    log4j.rootCategory=INFO,DISABLED
    # EVENTS
    log4j.category.nmy.STATE=INFO,0,DAY,OBS
    log4j.category.nmy.EXCEPTION=DEBUG,10,DAY
    log4j.category.nmy.SESSION=INFO,0,DAY
    log4j.category.nmy.REQUEST=INFO,0,DAY
    log4j.category.nmy.MESSAGE=INFO,0,DAY
    log4j.category.nmy.OBJECT=INFO,0,DAY
    log4j.category.nmy.DATA=INFO,0,DAY
    log4j.category.nmy.NONE=DEBUG,5,DAY
    # DO NOT MODIFY
    log4j.appender.DISABLED=com.myapp.util.logger.NullAppender
    # STANDARD OUTPUT DRIVER SETTINGS
    log4j.appender.CON=org.apache.log4j.ConsoleAppender
    log4j.appender.CON.Target=System.out
    log4j.appender.CON.layout=com.myapp.util.logger.LoggerLayout
    log4j.appender.CON.layout.ConversionPattern=+{DATE_TIME};{EVENT_ID};{SESSION_ID};{SEVERITY};{MODULE};{THREAD_ID};{EVENT_TYPE};{ERROR_CODE};{DESCRIPTION};{DEBUG_INFO}
    # ROLLING FILE OUTPUT DRIVER SETTINGS
    log4j.appender.ROL=org.apache.log4j.RollingFileAppender
    log4j.appender.ROL.File=/var/opt/apps/myapp/var/logs/application.log
    log4j.appender.ROL.MaxFileSize=4000KB
    log4j.appender.ROL.MaxBackupIndex=5
    log4j.appender.ROL.layout=com.myapp.util.logger.LoggerLayout
    log4j.appender.ROL.layout.ConversionPattern=+{DATE_TIME};{EVENT_ID};{SESSION_ID};{SEVERITY};{MODULE};{THREAD_ID};{EVENT_TYPE};{ERROR_CODE};{DESCRIPTION};{DEBUG_INFO}
    # DAILY OUTPUT DRIVER SETTINGS
    log4j.appender.DAY=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.DAY.File=/var/opt/apps/myapp/var/logs/daily_application.log
    log4j.appender.DAY.DatePattern='.'yyyy-MM-dd
    log4j.appender.DAY.layout=com.myapp.util.logger.LoggerLayout
    log4j.appender.DAY.layout.ConversionPattern=+{DATE_TIME};{EVENT_ID};{SESSION_ID};{SEVERITY};{MODULE};{THREAD_ID};{EVENT_TYPE};{ERROR_CODE};{DESCRIPTION};{DEBUG_INFO}
    # ===========================================================================
    # SIMPLE FILE OUTPUT DRIVER SETTINGS WITH DEBUG_INFO
    log4j.appender.FIL=org.apache.log4j.FileAppender
    log4j.appender.FIL.File=/var/opt/apps/myapp/var/logs/fil_application.log
    log4j.appender.FIL.Append=false
    log4j.appender.FIL.layout=com.myapp.util.logger.LoggerLayout
    log4j.appender.FIL.layout.ConversionPattern=+{DATE_TIME};{EVENT_ID};{SESSION_ID};{SEVERITY};{MODULE};{THREAD_ID};{EVENT_TYPE};{ERROR_CODE};{DESCRIPTION};{DEBUG_INFO}
    # ===========================================================================
    # DAILY OBSERVATION FILE OUTPUT DRIVER SETTINGS
    log4j.appender.OBS=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.OBS.File=/var/opt/apps/myapp/var/logs/obslog.out
    log4j.appender.OBS.DatePattern=.yyyyMMdd
    log4j.appender.OBS.layout=com.myapp.util.logger.LoggerLayout
    log4j.appender.OBS.layout.ConversionPattern={DESCRIPTION}
    # log4j.appender.OBS.layout.ConversionPattern=+{DATE_TIME};{EVENT_ID};{SESSION_ID};{SEVERITY};{MODULE};{THREAD_ID};{EVENT_TYPE};{ERROR_CODE};{DESCRIPTION};{DEBUG_INFO}
    Regards...

    I found from the log4j 1.3 API javadoc, the DailyRollingFileAppender is deprecated. They use the RollingFileAppender instead and give one sample .
    Hope it helps!
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE log4j:configuration>
    <log4j:configuration debug="true">
    <appender name="ROLL" class="org.apache.log4j.rolling.RollingFileAppender">
    <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
    <param name="FileNamePattern" value="/wombat/foo.%d{yyyy-MM}.gz"/>
    </rollingPolicy>
    <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%c{1} - %m%n"/>
    </layout>
    </appender>
    <root">
    <appender-ref ref="ROLL"/>
    </root>
    </log4j:configuration>

Maybe you are looking for

  • Help! MM17 Authorization(M_MATE_STA) problem.

    Hi, experts! I have a problem of Mass change  (T-code:MM17)  authorization. I want to control our user that only can change data through MM17 and not allow to create new data to prevent accident. So, I set an authorization obj. M_MATE_STA(Material Ma

  • SQL Query in MAxDB..

    Hi Friends, Could you please let me know what should i change to execute the query in MaxDB? select distinct t1.*, iif(t2.id is NULL, 0, 1) as hassub from content t1 left join content t2 on (t1.id=t2.parent_id) where t1.parent_id=" & id & " order by

  • Drill Down in Pie Chart

    In Xeelsius 2008 when I click on the Drill Down tab of the Pie Chart then the total tab is in disable mode so unable to add the drill down property.Please suggest me how to proceed

  • CC crashing reguarly

    Since using CC, either Photoshop or Bridge will crash in the middle of editing.  On average about 4 times an hour.   Sometimes it will just quit the program.  Other times, whilst in PS, the drop down menus will just appear as white boxes rather than

  • Search criteria not including .doc format

    When using the search criteria "Kind > is > Document" in Finder it will not include the .doc extension format but does include .docx, PDF, etc.. This also happens when using the Document search criteria in Automator. But if I just type the word "Docu