On Jul 10, 2009, at 12:36 AM, johnxmas wrote:


try the following code:

<gbean class = "org .apache .geronimo.system.logging.log4j.ApplicationLog4jConfigurationGBean" name="DirectoryLog4jConfiguration">
     <attribute name="log4jFile">META-INF/log4j.properties</attribute>
   <reference name="ServerInfo"><name>ServerInfo</name></reference>
</gbean>

anything else, let us know.

Jeff C


In this case, I get
org.apache.geronimo.kernel.config.LifecycleException: start of com.scort.demos/vscics/1.0/ear failed
//
Caused by: org.apache.geronimo.gbean.InvalidConfigurationException: Configuration com.scort.demos/vscics/1.0/ear failed to start due to the following reasons: The service J2EEApplication=com.scort.demos/vscics/1.0/ ear,j2eeType=SystemLog,name=DirectoryLog4jConfiguration did not start because D:\geronimo-tomcat6-javaee5-2.1.3\META-INF \log4j.properties (Le fichier spécifié est introuvable)

That would work if you put your log4j properties file there as your configuration says you have. If you use a file outside the rar I strongly recommend putting it in var/your-app/log4j.properties. If you are building a geronimo plugin using the car-maven-plugin you can easily pack the properties file into the plugin and arrange for it to be unpacked on installation. I receommend this kind of file based approach since it lets users edit the config file easily.


If i put log4.properties at the root of my rar and modifies gerionimo-ra.xml <gbean class = "org .apache .geronimo.system.logging.log4j.ApplicationLog4jConfigurationGBean" name="DirectoryLog4jConfiguration">
  <attribute name="log4jFile">log4j.properties</attribute>
  <reference name="ServerInfo"><name>ServerInfo</name></reference>
 </gbean>

I get

org.apache.geronimo.kernel.config.LifecycleException: start of com.scort.demos/vscics/1.0/ear failed

//
Caused by: org.apache.geronimo.gbean.InvalidConfigurationException: Configuration com.scort.demos/vscics/1.0/ear failed to start due to the following reasons: The service J2EEApplication=com.scort.demos/vscics/1.0/ ear,j2eeType=SystemLog,name=DirectoryLog4jConfiguration did not start because D:\geronimo-tomcat6-javaee5-2.1.3\log4j.properties (Le fichier spécifié est introuvable)

So where must I put the properties file ? (BTW, another question: may I use a log4j.xml file ?)

If you want to keep the log.4j properties in the rar you need to get it on the classpath so it can be found by the classloader. I.e., put it in the classes jar inside the rar. Then you need to use the log4jResource attribute and leave out the ServerInfo reference. Since this will make it nearly impossible to edit the log4j.properties I can't really recommend this variant.

AFAIK log4j.xml files are not supported right now. I haven't tried them or investigated what would be needed to support them, it might be very easy.... patches welcome!

thanks
david jencks

Reply via email to