logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jayesh Vora <jayesh.v...@gmail.com>
Subject How can I prevent a log file from getting created?
Date Wed, 08 Dec 2004 10:57:45 GMT

In my code, I call PropertyConfigurator.configure() method to
configure my log files. This creates the log files at the specified
location if they are not present.

If before this, I know (at runtime) that I am not going to use a
particular log file and instead I want to use a new log file (I can do
this with the help of code below), how can I prevent "creation" of the
original log file? Please note that I can't change log4j configuration
file for this, because at runtime I decide to take a different course.

code fragment:
      FileAppender appender = (FileAppender) logger.getAppender("SomeFile");

      Layout lo = appender.getLayout();


      FileAppender app2 = null;

      try {
          app2 = new FileAppender(lo, "D:/log/new_file.log", true);
      } catch (Exception e) {



To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message