Thanks Xh!!!
I'll test it; the result or any detail will be posted here.
Keeping in touch,
Waldo
Xh wrote:
>
> Hi Waldo!
>
> Problem solved ;)
>
> I've written simple servlet and deployed it on Geronimo 2.0.1.
>
> The solution is to use servlet's init method.
>
> Check this out.
>
> web.xml:
> <servlet>
> <display-name>Test</display-name>
> <servlet-name>Test</servlet-name>
> <servlet-class>org.xh.log4jtest.Test</servlet-class>
> <init-param>
> <param-name>log4j-init-file</param-name>
> <param-value>WEB-INF/classes/log4j.xml</param-value>
> </init-param>
> </servlet>
>
> and the org.xh.log4jtest.Test servlet's init method:
>
> public void init() {
> String prefix = getServletContext().getRealPath("/");
> String file = getInitParameter("log4j-init-file");
> if (file != null) {
> DOMConfigurator.configure(prefix + file);
> }
> }
>
> now it works in Geronimo 2.0.1
>
> best regards
> Łukasz
>
> ----- Original Message ----
> From: Waldo Ramírez Montaño <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Wednesday, 5 September, 2007 7:51:10 PM
> Subject: Re: Logging in Geronimo 2.0.1
>
>
> Thanks for your answer,
>
> But that's the problem :(
> Previously, an app in Geronimo 1.1.1 worked ok and it creates the log as
> you
> described, but in Geronimo 2.0.1... the same config didn't work!!!
> Even I've tested inverse classloading in Geronimo's deployment descriptor
> and the same.
>
> I'll compare your xml with mine; thanks again.
> Waldo
>
>
>
> Xh wrote:
>>
>> Hi,
>>
>> You can use Your own Log4j configuration in your applications (to tell
>> the
>> truth I've only used it in WAR).
>>
>> Below is my configuration that works with WAS-CE (based on Geronimo 1.1).
>> It should also work on G2.0.1 (I have G2.0.1, but I haven't migrated the
>> project, yet).
>>
>> Place Your own log4j.xml and log4j.dtd in e.g. WEB-INF/classes directory
>> (it must be on the class path). Add log4j librarry to Your project
>> WEB-INF/lib.
>>
>> To load new instance of Log4J Logger and all other classes, You need to
>> inform Geronimo that
>> You want Your own classes to be loaded, in deployment file e.g.
>> geronimo-web.ml in <environment> add this:
>>
>> <hidden-classes>
>> <filter>org.apache.log4j</filter>
>> </hidden-classes>
>>
>> Geronimo will load Your classes from org.apache.log4j package (including
>> sub-packages).
>>
>> My log4j.xml looks sth like this:
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
>> <log4j:configuration>
>> <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
>>
>> <layout class="org.apache.log4j.PatternLayout">
>>
>> </layout>
>> <filter class="org.apache.log4j.varia.LevelRangeFilter">
>>
>>
>> </filter>
>> </appender>
>> <appender name="stderr" class="org.apache.log4j.ConsoleAppender">
>>
>> <layout class="org.apache.log4j.PatternLayout">
>>
>> </layout>
>> <filter class="org.apache.log4j.varia.LevelRangeFilter">
>>
>>
>> </filter>
>> </appender>
>> <appender name="file"
>> class="org.apache.log4j.DailyRollingFileAppender">
>>
>>
>>
>> <layout class="org.apache.log4j.PatternLayout">
>>
>> </layout>
>> </appender>
>>
>> <root>
>> <level value="all" />
>> <appender-ref ref="stdout" />
>> <appender-ref ref="stderr" />
>> <appender-ref ref="file" />
>> </root>
>> </log4j:configuration>
>>
>> And now all logs of Your application will be logged into:
>>
>> ${org.apache.geronimo.server.dir}/var/log/Log4jTest.log
>>
>> It works perfect ;)
>>
>> best regards
>> Łukasz
>>
>> ----- Original Message ----
>> From: Waldo Ramírez Montaño <[EMAIL PROTECTED]>
>> To: [email protected]
>> Sent: Monday, 3 September, 2007 8:14:09 PM
>> Subject: Logging in Geronimo 2.0.1
>>
>>
>> Hello,
>>
>> Is it possible that deployments (EJB's, WAR's, EAR's) have their own
>> log-files in Geronimo 2.0.1?
>>
>> Thanks again,
>> Waldo
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Logging-in-Geronimo-2.0.1-tf4373488s134.html#a12465934
>> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>>
>>
>>
>>
>>
>>
>> ___________________________________________________________
>> Want ideas for reducing your carbon footprint? Visit Yahoo! For Good
>> http://uk.promotions.yahoo.com/forgood/environment.html
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Logging-in-Geronimo-2.0.1-tf4373488s134.html#a12507419
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>
>
>
>
>
>
> ___________________________________________________________
> Yahoo! Answers - Got a question? Someone out there knows the answer. Try
> it
> now.
> http://uk.answers.yahoo.com/
>
>
--
View this message in context:
http://www.nabble.com/Logging-in-Geronimo-2.0.1-tf4373488s134.html#a12513281
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.