If you need all logs to be output to the file, then you need to set the appender to the root :
Instead, maybe you want to use the logger called "loader_debug" ? If this is the case, then please post a line from your java code where you're getting the Log. [ November 06, 2006: Message edited by: Satou kurinosuke ]
That's strange. Once you've got "runLog", how do you use it ? Could you please post one line where you're using runLog.
I've tried on my machine and the file is being generated. By the way Category.getInstance is being deprecated in the latest version of log4j, so maybe you should use the following instead : Logger log = Logger.getLogger("loader_debug");
Yes, that's really strange for me as well. Here is how I used it in code:
Yesterday evening I tried with a text configuration file instead of xml and it worked for me. But I am still wondering why it is not working with this xml file. Do you see anything abnormal in this xml file?
No I don't see anything particular. Maybe you should try to use the Logger tag instead of Category. I know they have the same meaning, but they are know as Logger now. Which version of JUnit are you using ? Maybe you should try with the latest version too.
I'm not familiar with programmatic configuration using DocumentBuilderFactory...presumably you were having issues that made simple configuration by putting log4j.xml in the classpath not possible? Why are you doing that?
I prefer to set this on the command line with -Dlog4j.debug
2. Get rid of this redundant piece. The <root> element configures the root logger, it doesn't accept any attributes as the additivity flag does not apply to the root logger, cannot have a name; info from Complete log4j manual (commercial - $ ).
3. put the additivity flag on the logger you don't want to be included up the hierarchy (loader_debug is the logger you don't want included up the hierarchy; root is up the hierarchy in this case). category/logger is probably not the problem, but logger is preferable.
posted 13 years ago
This was actually a old code, written by someone else, so even I am not sure why it was that way.
I also tried a few other things with that code today morning and finally figured out that code was not able to load the file properly.