0

I have tried for several days to configure log4j in my EJB without luck. I have two properties files that are never picked up in the classpath.

docx4j.properties

docx4j.Log4j.Configurator.disabled=true

log4j.properties

org.docx4j.convert.out.pdf.viaXSLFO=INFO
docx4j.convert.out.pdf.viaXSLFO=INFO
logger.log4j.docx4j.convert.out.pdf.viaXSLFO=INFO

I have tried putting these files in every possible directory, none of which are in the classpath of the EJB. I have tried putting them in the parent EAR project, which also doesn't work. I have tried putting them everywhere except the root of the EJB module because eclipse will not let me put any files there (I cannot paste and it is not a drop target for any dragged files).

Where can I put these files so that my EJB project stops putting red DEBUG text all over my PDF files?

Even when I manually move the properties files to the root of the EJB module I get some log4j errors and it still prints debug messages on my PDF output.

 SystemErr     R log4j:WARN No appenders could be found for logger (org.docx4j.jaxb.NamespacePrefixMapperUtils).
 SystemErr     R log4j:WARN Please initialize the log4j system properly.

Update - output of log4j.debug

O log4j: Using URL [file:/path/sbp_gen_mso/ejbModule/log4j.properties] for automatic log4j configuration.
O log4j: Reading configuration from URL file:/path/sbp_gen_mso/ejbModule/log4j.properties
O log4j: Could not find root logger information. Is this OK?
O log4j: Parsing for [docx4j.convert.out.pdf.viaXSLFO] with value=[OFF].
O log4j: Level token is [OFF].
O log4j: Category docx4j.convert.out.pdf.viaXSLFO set to OFF
O log4j: Handling log4j.additivity.docx4j.convert.out.pdf.viaXSLFO=[null]
O log4j: Finished configuring.
R log4j:WARN No appenders could be found for logger (org.docx4j.jaxb.NamespacePrefixMapperUtils).
R log4j:WARN Please initialize the log4j system properly.

This seems to point out that I am missing an extra "org." in my log4j property key. But the question remains, why doesn't eclipse allow me to create or move properties files into the root of the EJB if that is the only place to configure logging for it?

chugadie
  • 2,786
  • 1
  • 24
  • 33
  • do you get an error on server startup for LOG4j ? – user1428716 Feb 20 '13 at 17:11
  • No errors unless I hand copy the properties files into the root of the ejb jar file (bypassing eclipse restrictions). – chugadie Feb 20 '13 at 17:13
  • place this on the java command option when you start the server "-Dlog4j.debug" – user1428716 Feb 20 '13 at 17:14
  • Turning on log4j.debug helped me solve the problem. I wish eclipse would let me add .properties files to the EJB classpath, but I did it just from command line. If you want to make an answer out of your comment I'll check it. – chugadie Feb 20 '13 at 20:03

1 Answers1

0

place this on the java command option when you start the server "-Dlog4j.debug"

user1428716
  • 2,078
  • 2
  • 18
  • 37