Description much clearer, except I guess the choice is an OR, i.e. you do either 3, 4 OR 5. So likely 5 should be renumbered to 3…

 

Logging is getting through now. Cant see it in the log portlet though. Have to view it directly on the server. Maybe I should move to use plugins. I need to read a bit more about the difference. Thanks for the pointers!

 

G.

 

 

 

 

 

 

 

 


From: David Jencks [mailto:david_jencks@yahoo.com]
Sent: Mittwoch, 22. April 2009 18:23
To: user@geronimo.apache.org
Subject: Re: Concepts behind log file per WAR using log4j

 

 

On Apr 22, 2009, at 8:41 AM, Villemos, Gert wrote:



I have created the file ‘webapp/META-INF/documentcrawler-log4j.properties’.

 

 

My ‘pom.xml’ file contains;

 

<plugin>

<groupId>org.apache.geronimo.buildsupport</groupId>

      <artifactId>car-maven-plugin</artifactId>

      <configuration>

            <instance>

                  <plugin-artifact>

                        <copy-file relative-to="server" dest-dir="var/log">META-INF/documentcrawler-log4j.properties</copy-file>

                  </plugin-artifact>

            </instance>

      </configuration>

</plugin>

 

 

I have defined the ‘geronimo-web.xml’ file as;

 

<context-root>DocumentCrawlerApp</context-root>

   

<!--  Enable logging using log4j -->

<gbean name="DirectoryLog4jConfiguration" class="org.apache.geronimo.system.logging.log4j.ApplicationLog4jConfigurationGBean">

<attribute name="log4jFile">var/log/documentcrawler-log4j.properties</attribute>

<reference name="ServerInfo"><name>ServerInfo</name></reference>

</gbean>

 

 

When deploying the WAR file Geronimo throws a ‘file not found’ exception, pointing to [Geronimo home]/var/log/documentcrawler-log4j.properties. This seems to indicate to me that the file ‘documentcrawler-log4j.properties’ are not copied to the right folder in Geronimo as part of the deployment. This is not surprising as the copy statement is in the ‘pom.xml’ file, not in the ‘geronimo-web.xml’ file…

 

Perhaps my problem lies in the sentence ‘3. …by including something like this in the pom.xml that generates geronimo-plugin.xml’ in the article http://cwiki.apache.org/GMOxDOC21/configuring-application-specific-logging-with-log4j.html. In my environment the ‘geronimo-web.xml’ file is NOT generated based on the pom. It is simply taken as I have defined it…

 

What am I doing wrong?

 

I tried to clarify the documentation :-)  I originally wrote it assuming that everyone was always constructing geronimo plugins using maven and the car-maven-plugin  While I recommend this you can just deploy an app :-).

 

Anyway.... you need to put the log4j properties file in the appropriate location by hand if you are just deploying an app rather than constructing and installing a plugin.

 

Please check the doc update and let us know if it is clear.

 

thanks

david jencks



 

Thanks,

Gert.

 

 

 

 

 


From: David Jencks [mailto:david_jencks@yahoo.com] 
Sent: Dienstag, 21. April 2009 18:10
To: user@geronimo.apache.org
Subject: Re: Concepts behind log file per WAR using log4j

 

 

On Apr 21, 2009, at 8:52 AM, Villemos, Gert wrote:




I’m trying to understand how to setup logging using log4j with Geronimo. Found the article http://cwiki.apache.org/GMOxDOC21/configuring-application-specific-logging-with-log4j.html but I miss an explanation of the concepts behind the logging. Likely the problem I have with implementing the logging following the article are due to this missing understanding. Before bothering anyone with my faulty source code I would therefore like to know whether I have understood the concepts correctly;

 

1. Each deployed WAR can maintain separate log file(s), by including a ‘log4j.properties’ file in the WAR and a definition of where to unpack it in the ‘geronimo-web.xml’ deployment file.

 

You also need a geronimo plan for the war with an ApplicationLog4jConfigurationGBean gbean to tell log4j about the special configuration for the war's logging.




2. The ‘{GERONIMO_HOME}/var/log/server-log4j.properties’ file defines the log4j setup for the Geronimo server. When deploying WARs with their own log4j.properties files I do NOT have to change this file to make them work, the GBean ‘DirectoryLog4jConfiguration’ will manage this for me.

 

yes.  If you don't do anything your app's logging will also end up in this server log file.  You only need to follow the doc instructions if you want your app's logging to go to a separate file from the normal server logging.




3. The log files can be viewed from the administration console through the ‘server log’ portlet, and the ‘Filter Criteria’ drop down box will contain each registered log file.

 

I don't know if you can look at other log files using the console log viewer.

 

hope this helps

david jencks

 




 

Thanks,

Gert.

 


Please help Logica to respect the environment by not printing this email / Pour contribuer comme Logica au respect de l'environnement, merci de ne pas imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei die Umwelt zu schuetzen / Por favor ajude a Logica a respeitar o ambiente não imprimindo este correio electrónico. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

 


Please help Logica to respect the environment by not printing this email / Pour contribuer comme Logica au respect de l'environnement, merci de ne pas imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei die Umwelt zu schuetzen / Por favor ajude a Logica a respeitar o ambiente não imprimindo este correio electrónico. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

 


Please help Logica to respect the environment by not printing this email / Pour contribuer comme Logica au respect de l'environnement, merci de ne pas imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei die Umwelt zu schuetzen / Por favor ajude a Logica a respeitar o ambiente não imprimindo este correio electrónico. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.