Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating multiple logs in log4j causing weird effects
    primarykey
    data
    text
    <p>I am trying to create multiple logs in Log4j, but I am facing a weird problem. Here's the log4j.properties and the code implementing it.</p> <pre><code># Define the root logger with appender file log4j.rootLogger = DEBUG, FILEALL # Define the file appender log4j.appender.FILEALL=org.apache.log4j.FileAppender log4j.appender.FILEALL.File=${logfile.name} # Define the layout for file appender log4j.appender.FILEALL.layout=org.apache.log4j.HTMLLayout #log4j.appender.FILEMAIN=org.apache.log4j.FileAppender #log4j.appender.FILEMAIN.File=${logfilemain.name} #log4j.appender.FILEMAIN.layout=org.apache.log4j.HTMLLayout </code></pre> <p>I have added the statement when running both and removed the original one</p> <pre><code>log4j.rootLogger = DEBUG, FILEALL , FILEMAIN </code></pre> <p>And this is the java code:</p> <pre><code>System.setProperty("logfile.name", savePath1); // System.setProperty("logfilemain.name", savePath1); logger = Logger.getLogger(HarishLog.class.getName()); PropertyConfigurator.configure("log4j.properties"); </code></pre> <p>The code works perfectly fine till I make one log, but as soon as I enable the setting for 2nd log in either the properties or the javafile, nothing happens.</p> <p>Besides I am unable to put a different name at </p> <pre><code>log4j.appender.FILEALL.File=${logfile.name} </code></pre> <p>it only works for <code>logfile.name</code> and <code>logfilea.name</code>, It doesn't work for any other name if I change it both in the javacode and the properties folder. Why is this???</p> <p>Thank you</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload