On Apr 22, 2009, at 1:19 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.
[Gert] I thought the ‘geronimo-web.xml’ was the Geronimo plan for
the war, i.e. I have inserted the ApplicationLog4jConfigurationGBean
bean in this file… do I need another file as well?
that is the geronimo plan, and you don't need any other file.
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.
[Gert] So if I don’t do anything I should see my log messages in the
default log (… I dont). And if I follow the instructions on http://cwiki.apache.org/GMOxDOC21/configuring-application-specific-logging-with-log4j.html
I should see them somewhere else.
that's all correct.
It's been a while since I worked on this. IIRC some apps include a
log4j configuration file and some have code to install it in log4j.
Apps that do this generally end up turning off geronimo's logging. I
don't remember the details but if your app has a log4j.properties file
in it you might try removing it. Otherwise you may end up tracing
through log4j code to figure out why it thinks you don't want stuff
logged.
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.
[Gert] Ok… I’ll try and see… just wondered why there is a drop down
box on the log viewer. Seems to indicate that you can have multiple
logs.
good point :-)
thanks
david jencks
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.