Log filename in log4j.properties

Hi,
I use log4j for logging. It's configured in a log4j.properties file. I want to make a new logfile for each day, with the date appended to the filename. Is it possible to do this just with the log4j.properties configuration or I must configure the log in the program?
Thanks
Rui Gon?alves

There is a DailyRollingFileAppender to use.

Similar Messages

  • Very weird issue with server logging when using log4j.properties file

    I'm using log4j logging. In log4j.properties the root logger is set up to use the ServerLoggingAppender class so that all our application logs go to the main server logfile. In addition, there are several appenders defined for specific components, with output going to specific per-component log files. Everything is going fine until I launch the server console. At this point all of those per-component log files get wiped out (zero length) and some non-ASCII lines are written to at least one of these files, after which the logs appear to be fine. The main server log file does not appear to be affected (because the root logger is set to "warn" level, while component-specific loggers are set to trace, the contents in these files is different; however I tried disabling all the other appenders and turning the root logger up to trace, and that still did not re-create the problem in the main server log file.
    And here's the really weird part -- if I use the same configuration, but in a log4j.xml file, the problem does not happen.

    Figured it out.
    We were passing in the configuration for log4j as -Dlog4j.configuration=file:/<properties file> and this was added to the command line for both the managed and admin servers. Problem is that the console app starts its own instance of log4j, and when it reads the configuration for the appenders it initializes or rolls over the files. At some point we have two JVMs accessing the same files, so some corruption is bound to happen.
    I'm not clear why the .xml file made a difference, but earlier we had been passing the log4j configuration as a jar file placed in the domain/lib folder, so perhaps the designer reverted to that (placed the log4j.xml file in a jar in lib, and not simply changed the -Dlog4j.configuration=file:/ option.

  • How to set filename into log4j.properties using LogFactory from apache

    I'm getting a java.lang.ClassCastException .. Please help. Thanks.
    package src;
    import java.io.IOException;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import org.apache.log4j.Category;
    import org.apache.log4j.rolling.RollingFileAppender;
    public class FileLock {
    private static Log log = LogFactory.getLog(FileLock.class);
         public static void main(String[] args) throws IOException {
              // TODO Auto-generated method stub
              String logFile="C:/TEST123.TXT";
              RollingFileAppender apd = (RollingFileAppender) ((Category) log).getAppender("FILELOG");
              apd.setFile(logFile);
              apd.activateOptions();
              log.debug ( "This is a test debug");
              log.trace ( "This is a test trace");
              log.fatal ( "This is a test fatal");
    Snapshot from my log4j.xml.
    <appender name="FILELOG" class="org.apache.log4j.RollingFileAppender">
    <param name="File" value="C:/a.log" />
    <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern"
    value="[%d{ISO8601}] %-5p %c %m %n" />
    </layout>
    <filter class="org.apache.log4j.varia.LevelRangeFilter">
    <param name="LevelMin" value="DEBUG"/>
    <param name="LevelMax" value="INFO"/>
    </filter>
    </appender>
    *************

    Thanks here's the list:
    log4j:INFO Using URL [file:/C:/TEST2/FileLocking/bin/log4j.xml] for automatic log4j configuration of repository named [default].
    [2006-08-10 10:52:08,421] DEBUG org.apache.log4j.joran.action.ConfigurationAction Ignoring debug attribute.
    [2006-08-10 10:52:08,437] DEBUG org.apache.log4j.joran.action.AppenderAction About to instantiate appender of type [org.apache.log4j.FileAppender]
    [2006-08-10 10:52:08,453] DEBUG org.apache.log4j.joran.action.AppenderAction Appender named as [FILELOG]
    [2006-08-10 10:52:08,453] DEBUG org.apache.log4j.joran.action.AppenderAction Pushing appender on to the object stack.
    [2006-08-10 10:52:08,453] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [File] to value [C:/a.log].
    [2006-08-10 10:52:08,484] DEBUG org.apache.log4j.joran.action.LayoutAction About to instantiate layout of type [org.apache.log4j.PatternLayout]
    [2006-08-10 10:52:08,531] DEBUG org.apache.log4j.joran.action.LayoutAction Pushing layout on top of the object stack.
    [2006-08-10 10:52:08,531] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [ConversionPattern] to value [[%d{ISO8601}] %-5p %c %m %n].
    [2006-08-10 10:52:08,593] DEBUG org.apache.log4j.joran.action.LayoutAction Popping layout from the object stack
    [2006-08-10 10:52:08,593] DEBUG org.apache.log4j.joran.action.LayoutAction About to set the layout of the containing appender.
    [2006-08-10 10:52:08,593] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [LevelMin] to value [DEBUG].
    [2006-08-10 10:52:08,593] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [LevelMax] to value [INFO].
    [2006-08-10 10:52:08,593] DEBUG org.apache.log4j.FileAppender setFile called: C:/a.log, true
    [2006-08-10 10:52:08,609] DEBUG org.apache.log4j.FileAppender setFile ended
    [2006-08-10 10:52:08,609] DEBUG org.apache.log4j.joran.action.AppenderAction Popping appender named [FILELOG] from the object stack
    [2006-08-10 10:52:08,609] DEBUG org.apache.log4j.joran.action.AppenderAction About to instantiate appender of type [org.apache.log4j.ConsoleAppender]
    [2006-08-10 10:52:08,609] DEBUG org.apache.log4j.joran.action.AppenderAction Appender named as [STDOUT]
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.AppenderAction Pushing appender on to the object stack.
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [Target] to value [System.out].
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.LayoutAction About to instantiate layout of type [org.apache.log4j.PatternLayout]
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.LayoutAction Pushing layout on top of the object stack.
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [ConversionPattern] to value [[%d{ISO8601}] %-5p %c %m %n].
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.LayoutAction Popping layout from the object stack
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.LayoutAction About to set the layout of the containing appender.
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [LevelMin] to value [DEBUG].
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [LevelMax] to value [INFO].
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.AppenderAction Popping appender named [STDOUT] from the object stack
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.AppenderAction About to instantiate appender of type [org.apache.log4j.ConsoleAppender]
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.AppenderAction Appender named as [STDERR]
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.AppenderAction Pushing appender on to the object stack.
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [Target] to value [System.err].
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.LayoutAction About to instantiate layout of type [org.apache.log4j.PatternLayout]
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.LayoutAction Pushing layout on top of the object stack.
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [ConversionPattern] to value [[%d{ISO8601}] %-5p %c %m %n].
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.LayoutAction Popping layout from the object stack
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.LayoutAction About to set the layout of the containing appender.
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [LevelMin] to value [WARN].
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [LevelMax] to value [FATAL].
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.AppenderAction Popping appender named [STDERR] from the object stack
    [2006-08-10 10:52:08,625] DEBUG org.apache.log4j.joran.action.AppenderAction About to instantiate appender of type [org.apache.log4j.net.SMTPAppender]
    [2006-08-10 10:52:08,734] DEBUG org.apache.log4j.joran.action.AppenderAction Appender named as [EMAIL]
    [2006-08-10 10:52:08,734] DEBUG org.apache.log4j.joran.action.AppenderAction Pushing appender on to the object stack.
    [2006-08-10 10:52:08,734] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [BufferSize] to value [512].
    [2006-08-10 10:52:08,734] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [SMTPHost] to value [exchange.medi.com].
    [2006-08-10 10:52:08,734] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [From] to value [[email protected]].
    [2006-08-10 10:52:08,734] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [To] to value [[email protected]].
    [2006-08-10 10:52:08,734] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [Subject] to value [[SMTPAppender] Application message].
    [2006-08-10 10:52:08,734] DEBUG org.apache.log4j.joran.action.LayoutAction About to instantiate layout of type [org.apache.log4j.PatternLayout]
    [2006-08-10 10:52:08,734] DEBUG org.apache.log4j.joran.action.LayoutAction Pushing layout on top of the object stack.
    [2006-08-10 10:52:08,734] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [ConversionPattern] to value [[%d{ISO8601}]%n%n%-5p%n%n%c%n%n%m%n%n].
    [2006-08-10 10:52:08,750] DEBUG org.apache.log4j.joran.action.LayoutAction Popping layout from the object stack
    [2006-08-10 10:52:08,750] DEBUG org.apache.log4j.joran.action.LayoutAction About to set the layout of the containing appender.
    [2006-08-10 10:52:08,750] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [LevelMin] to value [ERROR].
    [2006-08-10 10:52:08,750] DEBUG org.apache.log4j.joran.action.ParamAction In ParamAction setting parameter [LevelMax] to value [FATAL].
    [2006-08-10 10:52:08,812] DEBUG org.apache.log4j.joran.action.AppenderAction Popping appender named [EMAIL] from the object stack
    [2006-08-10 10:52:08,812] DEBUG org.apache.log4j.joran.action.RootLoggerAction Pushing root logger on stack
    [2006-08-10 10:52:08,812] DEBUG org.apache.log4j.joran.action.LevelAction Encapsulating logger name is [root], levelvalue is [all].
    [2006-08-10 10:52:08,812] DEBUG org.apache.log4j.joran.action.LevelAction root level set to ALL
    [2006-08-10 10:52:08,812] DEBUG org.apache.log4j.joran.action.AppenderRefAction Attaching appender named [FILELOG] to logger named [root].
    [2006-08-10 10:52:08,812] DEBUG org.apache.log4j.joran.action.AppenderRefAction Attaching appender named [STDOUT] to logger named [root].
    [2006-08-10 10:52:08,812] DEBUG org.apache.log4j.joran.action.AppenderRefAction Attaching appender named [STDERR] to logger named [root].
    [2006-08-10 10:52:08,812] DEBUG org.apache.log4j.joran.action.AppenderRefAction Attaching appender named [EMAIL] to logger named [root].
    [2006-08-10 10:52:08,812] DEBUG org.apache.log4j.joran.action.RootLoggerAction Removing root logger from top of stack.
    [2006-08-10 10:52:08,812] DEBUG org.apache.log4j.joran.JoranConfigurator Finished parsing.
    java.lang.ClassCastException
         at src.FileLock.main(FileLock.java:19)
    Exception in thread "main"

  • LMS3.2.1 - should my custom log rotation settings override log4j properties?

    For LMS 3.2.1 on Windows, I have configured log rotation settings for dcmaservice.log but the settings are ineffective, even after stop/start CW daemon manager.  Other posts on this forum state that dcmaservice.log rotation is managed by log4j but can also be configured in logrot.  Is this incorrect or have I encountered a bug in logrot?

    Gaganjeet,
    I'd like definitive answers to the following questions before continuing down this path.
    1) does log4j subsystem manage dcmaservice.log?
    2) if so, is there a log4j properties file for dcmaservice which can be edited to change log file size and number of versions to keep (eg. see the forum entry https://supportforums.cisco.com/message/664225#664225 re license.log)?
    3) can Common Services user-configurable log rotation override the parameters for logs managed by log4j subsystem?
    Thanks.

  • Changing Log4j properties for the log file

    Hi All
    I want to set up some log4j properties(format ..etc) for the log file located at
    <OracleAS_HOME>\opmn\logs\default_group~home~default_group~1.log
    But i am unable to find the xml file where I can tune the properties. Any pointer will be of great help!!
    Thanks

    Hi
    opmn.xml has entry for opmn\logs\opmn.log only.... can't find the entry for the log file i need
    Thanks

  • Cost involved in changing the code using log4j.properties to log4j.xml

    i have finished my application, and it was done in such a way that logging is done using log4j but it was using log4j.properties file.
    now i need to change it to log4j.xml. i need to do this at the earliest. so i need to know the cost involved in it?. do i need to change a lot on my app to read the log4j.xml?. In my app there is a function named getProperties, which actually reads the log4j.properties file.
    this is the code of that function
    public static Properties getProperties(String filename,String path) throws myException
    //InputStream is = null;
    FileInputStream is=null;
            Properties props = new Properties();       
            //ClassLoader classLoader = ResourceUtil.class.getClassLoader();
            //is = classLoader.getResourceAsStream(filename);
            File catalinaHome = new  File(System.getProperty("catalina.home"));     
            try {       
    is=new
    FileInputStream(catalinaHome.getCanonicalFile()+path + filename);
    } catch (IOException e) {
            if(is == null)
                String message = "Cannot locate property file " + filename + " in the classpath";
                log.error(message);
            throw new myException(message);
            try
                props.load(is);
            catch (IOException e)
                String message = "Error reading property file " + filename;
                log.error(message);
            throw new myException(message, e);
            finally
                try
                    is.close();
                catch(Throwable t)
                    t.printStackTrace();
            if(props.isEmpty())
                String message = "No properties are defined in " + filename;
                log.error(message);
            throw new myException(message);
            return props;       
    }and my initialize function is
    public static void initialize()
    Properties properties=null;
    try {
    String path="/properties/";
    properties=ResourceUtil.getProperties("log4j.properties",path);
    } catch (myException e2) {
    e2.printStackTrace();
    PropertyConfigurator.configure(properties);
    }Message was edited by:
    xema
    Message was edited by:
    xema
    Message was edited by:
    xema

    >
    1. Restructure log4j.properties into log4j.xml.
    thats done
    2. Move log4j.xml into a directory that's in the
    classpath.
    actually i donot understand what does it mean to move in a directory thats in classpath means. i have to use logging in my webapplication running in tomcat. and my log4j.xml has to reside in catalina.home/properties/. My log4j.properties have been residing here and it had worked well woth the previous function. Now what i did is placed the log4j.xml under properties folder. Now tell me what modifications should i make in the above code.
    3. Remove any code that explicitly configures log4j
    (i.e. the initialize() method) because log4j will
    configure itself from any properties file it finds in
    the classpath, automatically, the first time it is
    called.I prefer not remvoing this function as this function is being called in many of my classes... and we don't have time to edit all...
    please help... and excuse me if i asked some blunders.!!!

  • How to set log filename dynamically

    Hi all!
    Could anybody give me a hint how I can set file name for log4j dynamically.
    I have a log4j.properties file:
    log4j.rootCategory=debug, stdout, R
    #### First appender writes to console
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    # Pattern to output the caller's file name and line number.
    log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %-6p [%c{1}] %m%n
    #### Second appender writes to a file
    log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.R.DatePattern='.'yyyy-MM-dd
    log4j.appender.R.File=Myfilename.log
    log4j.appender.R.MaxFileSize=10000KB
    log4j.appender.R.MaxBackupIndex=1
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%d{ABSOLUTE} %-6p [%c{1}] %m%nand following code in my class:
    Logger LOGGER = Logger.getLogger(MyClass.class);
    File logFile = new File("newFilename.log");
                logFile.createNewFile();
                FileAppender r = (FileAppender)LOGGER.getAppender("R");
                r.setFile(logFile.getAbsolutePath());
                r.activateOptions();Unfortunately it does not work as r is NULL.
    It throws java.lang.NullPointerException.
    Could anybody help me?

    I wouldn't try to mess with the file name. I'd use logging the way it is intended - with the correct log file name configured.
    Even if you successfully do that, what do you suppose will happen when the log "rolls over"? Do you expect it to honor the fact that you've changed the base file name? I would expect it is going to fail when it closes the log, renames it using the rolling pattern, and creates a new log.

  • Multiple log files using Log4j

    Hello,
    I want to generate log files based on package structure. Like com.temp.test in test.log ,also I am having a log file at application like app.log .
    This is my requirement what has been logged in test.log should not be logged in app.log.This is my log4j.properties file.
    # Log4j configuration file.
    # Available levels are DEBUG, INFO, WARN, ERROR, FATAL
    # Default logger
    log4j.rootLogger=DEBUG, PFILE
    log4j.logger.com.temp.test=DEBUG,TEST
    # PFILE is the primary log file
    log4j.appender.PFILE=org.apache.log4j.RollingFileAppender
    log4j.appender.PFILE.File=./App.log
    log4j.appender.PFILE.MaxFileSize=5120KB
    log4j.appender.PFILE.MaxBackupIndex=10
    #log4j.appender.PFILE.Threshold=DEBUG
    log4j.appender.PFILE.layout=org.apache.log4j.PatternLayout
    log4j.appender.PFILE.layout.ConversionPattern=%p %d[%l][%C] %m%n
    #log4j.appender.PFILE.layout.ConversionPattern=%p %d %m%n
    log4j.appender.TEST=org.apache.log4j.RollingFileAppender
    log4j.appender.TEST.File=./test.log
    log4j.appender.TEST.MaxFileSize=5120KB
    log4j.appender.TEST.MaxBackupIndex=10
    log4j.appender.TEST.layout=org.apache.log4j.PatternLayout
    log4j.appender.TEST.layout.ConversionPattern=%p %d[%l][%C] %m%n
    Can u help me!!!

    You have to configure the temp logger so that it does not send its info on to the root logger.
    For this, you can use the additivity flag.
    # Default logger
    log4j.rootLogger=DEBUG, PFILE
    log4j.additivity.com.temp.test=false
    log4j.logger.com.temp.test=DEBUG,TESTThe rest of the file remains the same.

  • Configuring directory path for fileappender in log4j.properties

    I want to write log data to a file where the directory path of the file should be picked from a unix environmental variable. How can you configure this in log4j.properties?
    log4j.rootLogger=INFO, A
    # A is set to be a FileAppender.
    log4j.appender.A=org.apache.log4j.FileAppender
    # A uses PatternLayout.
    log4j.appender.A.File=$UNIX_ENV_VARIABLE/A.log <= This is what I want. The dir path should be picked from some env path
    log4j.appender.A.layout=org.apache.log4j.PatternLayout
    log4j.appender.A.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%t] %-5p %c %x - %m%n
    Or if this should be done in code, then please guide me on that.
    Thanks in advance

    Hi,
    i am facing one problem,
    where today's log and yesterday log has log statements for today with same date.. but different data. any one pls help.
    this is the properties i configured
    # Logger for A messages
    log4j.logger.A=debug, A_R1
    log4j.appender.A_R1=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.A_R1.File=/var/opt/wmeaidata/app_data/log4j/logs/eai_a.log
    log4j.appender.A_R1.MaxFileSize = 5MB
    log4j.appender.A_R1.MaxBackupIndex = 3
    log4j.appender.A_R1.layout=org.apache.log4j.PatternLayout
    log4j.appender.A_R1.layout.ConversionPattern=%d{MMM dd, yyyy hh:mm:ss a}|%c-%X{host}|%m%n
    Thanks
    venkat

  • A question about log4j.properties

    Normally I put the log4j.properties inside my web-application such as under WEB-INF. So it will be packaged into the WAR.
    But now I want to take it outside of the WAR and put it under a dir and furthermore I change its name to "myLog4j.log4j.properties". This has two advantages:
    1.
    One can change the contents without opent the WAR.
    2.
    Under this dir the other projects can put their xxx.log4j.properties so they can be managed easily.
    But I don't know where should I put this file and how to configure the server sothat the server can find this file and my program can write all the log infos into the log-file defined in the "myLog4j.log4j.properties".
    Can someone help?
    Regards

    Actually file log4j.properties should be in the classpath, that classloader could see it. Add the path to file into CLASSPATH.
    Thanks

  • Log4j.properties or log4j.xml Not Reading

    Hello,
    I am trying to use log4j in jsp.
    I have added log4j.properties in /WEB-INF/log4j.properties.
    And in jsp page, I added like
    Logger logger = Logger.getLogger("test1.jsp");When I run jsp page, I get
    log4j:WARN No appenders could be found for logger (test1.jsp).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.Is this the right place to keep log4j.properties file? Does java classes can read if I put under /WEB-INF folder?
    If I am using log4j.xml where to keep this file?
    Regards
    Edited by: Chackochen on Aug 14, 2010 1:19 AM
    Edited by: Chackochen on Aug 14, 2010 1:20 AM

    Here is what I figured:
    add properties to the workspace/WEIB-INF/directory.xml and then read them from the PAPI code using
         String myProp = DirectoryConfigurationManager.getRuntime("default").getConfigurationProperty("categoryName", "propKey");

  • Problem with log4j.properties and level DEBUG

    Hi,
    I need some log4j help.
    I create 2 different appenders in the log4j.properties file
    and it works.
    This is my complete log4j.properties:
    log4j.logger.log1=DEBUG, log1
    log4j.logger.log2=DEBUG, log2
    log4j.appender.log1=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.log1.File=${StandardLogPath}
    log4j.appender.log1.DatePattern='.'yyyy-MM-dd
    log4j.appender.log1.Append=true
    #log4j.appender.log1.Threshold=DEBUG
    log4j.appender.log1.layout=org.apache.log4j.PatternLayout
    log4j.appender.log1.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} [%-5p] %-25c{1} %m%n
    log4j.appender.log2=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.log2.File=${StandardLogQueryPath}
    log4j.appender.log2.DatePattern='.'yyyy-MM-dd
    log4j.appender.log2.Append=true
    log4j.appender.log2.layout=org.apache.log4j.PatternLayout
    log4j.appender.log2.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} [%-5p] %-25c{1} %m%nAnd here's my logging code:
    import org.apache.log4j.Logger;
    Logger log = Logger.getLogger("log1");
    Logger logQuery = Logger.getLogger("log2");
    log.debug("loggerDebug");
    logQuery.debug("loggerDebug");
    log.info("loggerInfo");
    logQuery.info("loggerInfo");The problem is that "loggerDebug" is not written to all appenders (only "loggerInfo").
    In fact if I print:
    System.out.println( log.getEffectiveLevel().toString() );result that the level is INFO and I known that if level is INFO then DEBUG is disable.
    But why the level is INFO????
    Someone can suggest me a solution?
    Thank you very much

    You're so over-sensitive you: when an OP doesn't respond anymore
    to your last reply it implies that you've solved the problem and
    (implicitly) that the OP is very grateful to you. Why do you always
    have to be so explicit about matters? ;-)
    Because I'm not one of those Dutch people ;-)Yes, that's us, the Dutch: mysteriously smiling and keeping silent all the
    time. That's why they call us the Asians of Western Europe ;-)
    ps. There are nice exception to the rule sometimes though.
    Yes, and unfortunately they do seem to be the exception rather than
    the rule. It would be nice to catch one a bit more often.True; that's the internet generation: grab all the information that you can
    and don't give a f*ck about the guy who supplied the information. It's sad
    indeed.
    Maybe we should start a support group where we could thank each
    other now and then 'on behalf' of those little spoiled brats and complain
    about all those bad manners nowadays ;-)
    kind regards,
    Jos

  • Getting empty log files with log4j and WebLogic 10.0

    Hi!
    I get empty log files with log4j 1.2.13 and WebLogic 10.0. If I don't run the application in the application server, then the logging works fine.
    The properties file is located in a jar in the LIB folder of the deployed project. If I change the name of the log file name in the properties file, it just creates a new empty file.
    What could be wrong?
    Thanks!

    I assume that when you change the name of the expected log file in the properties file, the new empty file is that name, correct?
    That means you're at least getting that properties file loaded by log4j, which is a good sign.
    As the file ends up empty, it appears that no logger statements are being executed at a debug level high enough for the current debug level. Can you throw in a logger.error() call at a point you're certain is executed?

  • JMS Appender in log4j.properties ??

    Hie Experts,
    I have setup a logging mechanism to log messages asynchronously using JMS queue.
    Currently, I am doing this as a call to a method.
    Inside the method, I am
    - creating a JNDI context,
    - retrieve queue connection factory,
    - create a queue session, create a queue sender and
    - associate to the retrieved queue.
    - Finally I send the message and close the queue.
    I do not think that this is the best strategy because:
    1. Queue gets initialized for all logging (making it slower)
    2. I believe that there must be a simpler way such as adding a JMS appender in log4j.properties
    Please advise if there is a better strategy.
    Thanks,
    V Chitkara

    Hi Vishal,
    You are correct in your assumption that there is a simpler way to perform logging using JMS.
    The Log4J project already contains a JMS appender. Take a look at this page:
    http://logging.apache.org/log4j/docs/manual.html
    And search it for "JMS".
    Hope this helps,
    Tom Jenkinson
    Arjuna Technologies Limited

  • Editing log4j.properties file of ear while deploying ear file.

    Hi,
    Can i edit log4j.properties file of ear while deploying ear file.
    ~ Dhiraj.

    javainstead:
    >>is MyFolder in the root? else you mite wanna try giving the entire path starting from the root
    No the "MyFolder" is not in the root. Normally if we give the file name alone, it will store in a directory. Instead of storing in that directory, i want to have create another subfolder under that directory and storing the file in it. This is my need.
    OS: Windows 2000.
    zakir_sh:
    log4j.rootCategory=DEBUG,myproj
    log4j.appender.myproj=org.apache.log4j.RollingFileAppender
    log4j.appender.myproj.File=/u3/logs/myproj_webapp_logs/dev_region/mylogfile.log......
    I gave relative path like this and got the file not found error.
    log4j.appender.myproj.File=/MyFolder/error_file.log
    Thanks,
    Manikandan

Maybe you are looking for

  • Conditional Row formatting not working in RTF

    Hi Everyone, Using the code from the documentation, I have managed to get every other row in my report to highlight, but only when displayed in a PDF. It doesn't come out with any row formatting when viewed as an RTF. Can anyone explain why this is,

  • Can you use a Mac Apps gift card to purchase products from the Apple store online?

    I was just wondering if you can use that $100 back to school gift card to purchase something from the apple store. (for example: the headphones) Thanks~

  • Regarding structure of abap program

    hi, can any one exaplain to me what is the structure of the abap program. thank&regards, ramnaresh

  • Safari 7.0.5 constantly crashing

    Hi, any help appreciated.  I have a MacBook Pro 13-inch mid-2012 model, with 2.9 GHz Intel Core i7, and 8 GB 1600 MHz DDR 3 memory.  Memory storage capacity is 749.3 GB, of which 558.56 GB is available.  I have OS X 10.9.4 and Safari 7.0.5, and all o

  • Reminder Notifcation Wont Go Away

    I have deleted all of my lists and still the notifcation symbol is on my Reminders. I do not have anything. How can I remove it? For someone who has OCD, this is really bothering me.