Re: Geronimo 2/Log4j question

2008-03-13 Thread David Jencks
getRealPath("/");
String file =
ctx.getServletContext().getInitParameter("log4j-configuration- 
file");

if (file != null) {
DOMConfigurator.configure(prefix + "WEB-INF/" + file);
}
}

it works in G2.0.0 and G2.1

If You manage to use Log4j without this workaround, let me know
please ;)

best regards
Łukasz

On 27/02/2008, Jacek Laskowski <[EMAIL PROTECTED]> wrote:
On Tue, Feb 5, 2008 at 11:10 AM, Adam Ruggles  
<[EMAIL PROTECTED]>

wrote:


 I am also having this issue.  In tomcat I just needed a
log4j.xml in

my

 classpath, however geronimo seems to ignore it.

 The only solution I've found is to have Spring configure  
log4j

through the
 web.xml but that takes over all logging in geronimo.  I  
need to

have
 separate logging for each of my web apps.


 Have you tried to inverse-classloading and/or hidden-classes
elements
 in your plan so log4j and its configuration in Geronimo is for
 Geronimo stuff and yours is for your stuff?

 Jacek


 --
 Jacek Laskowski
 http://www.JacekLaskowski.pl






--
View this message in context: http://www.nabble.com/Geronimo-2-
Log4j-question-tp12865061s134p15879047.html
Sent from the Apache Geronimo - Users mailing list archive at
Nabble.com.







--
View this message in context: http://www.nabble.com/Geronimo-2- 
Log4j-question-tp12865061s134p15882415.html
Sent from the Apache Geronimo - Users mailing list archive at  
Nabble.com.












Re: Geronimo 2/Log4j question

2008-03-13 Thread David Jencks
fix + "WEB-INF/" + file);
}
}

it works in G2.0.0 and G2.1

If You manage to use Log4j without this workaround, let me know
please ;)

best regards
Łukasz

On 27/02/2008, Jacek Laskowski <[EMAIL PROTECTED]> wrote:
On Tue, Feb 5, 2008 at 11:10 AM, Adam Ruggles  
<[EMAIL PROTECTED]>

wrote:


 I am also having this issue.  In tomcat I just needed a
log4j.xml in

my

 classpath, however geronimo seems to ignore it.

 The only solution I've found is to have Spring configure log4j

through the
 web.xml but that takes over all logging in geronimo.  I  
need to

have
 separate logging for each of my web apps.


 Have you tried to inverse-classloading and/or hidden-classes
elements
 in your plan so log4j and its configuration in Geronimo is for
 Geronimo stuff and yours is for your stuff?

 Jacek


 --
 Jacek Laskowski
 http://www.JacekLaskowski.pl






--
View this message in context: http://www.nabble.com/Geronimo-2-
Log4j-question-tp12865061s134p15879047.html
Sent from the Apache Geronimo - Users mailing list archive at
Nabble.com.







--
View this message in context: http://www.nabble.com/Geronimo-2- 
Log4j-question-tp12865061s134p15882415.html
Sent from the Apache Geronimo - Users mailing list archive at  
Nabble.com.










Re: Geronimo 2/Log4j question

2008-03-06 Thread David Jencks
.  In tomcat I just needed a
log4j.xml in

my

 classpath, however geronimo seems to ignore it.

 The only solution I've found is to have Spring configure log4j

through the

 web.xml but that takes over all logging in geronimo.  I need to
have
 separate logging for each of my web apps.


 Have you tried to inverse-classloading and/or hidden-classes
elements
 in your plan so log4j and its configuration in Geronimo is for
 Geronimo stuff and yours is for your stuff?

 Jacek


 --
 Jacek Laskowski
 http://www.JacekLaskowski.pl






--
View this message in context: http://www.nabble.com/Geronimo-2-
Log4j-question-tp12865061s134p15879047.html
Sent from the Apache Geronimo - Users mailing list archive at
Nabble.com.







--
View this message in context: http://www.nabble.com/Geronimo-2- 
Log4j-question-tp12865061s134p15882415.html
Sent from the Apache Geronimo - Users mailing list archive at  
Nabble.com.








Re: Geronimo 2/Log4j question

2008-03-06 Thread David Jencks
You have to be careful about what properties you feed to log4j. I  
did get this approach working with the roller plugin.  Look for the  
roller-custom.properties file in the plugins/roller/trunk stuff


have to run again, more later

david jencks

On Mar 6, 2008, at 11:52 AM, Adam Ruggles wrote:



The problem with the ServletContextListener approach is that it  
takes over

the log4j for all apps.

For instance, I have two web apps running in geronimo.  They share  
a common
code base.  I need each one to manage their own logging.  Right now  
using

the Listener approach, the following occurs.

WebApp 1 starts up and begins logging com.my.package

Everything looks good so far.

WebApp2 starts up and begins logging com.my.package.  Now WebApp 1  
is no
longer writing out to the log files and WebApp2's logs contains  
logging

information from WebApp1 and WebApp2.

By the way in both cases the geronimo.log file is affected as well.


djencks wrote:


The solution I know of is to include a log4j.properties file if you
want to run on servers that do not use log4j internally but to have
your ServletContextListener read an app specific properties file that
sets up the appender for your app and other such customizations and
feeds the info to log4j programatically.

Roller uses this technique.

I'm not sure exactly what the log4j API for this is and have to run
now, if you can't find it I can look more later.
thanks
david jencks

On Mar 6, 2008, at 9:22 AM, Adam Ruggles wrote:



I used Spring to create the listener like you've described here.
It works,
but the only problem is that I have multiple web apps and I'd like
them to
maintain their own log, however using this method causes the last
web app to
load to take over the logging.



Łukasz Budnik wrote:


Hi!

I had the very same problem with G2.0.0, currently I'm using  
G2.1 and

to tell the truth I don't know whether this issue still exists
because
I use a very simple work around that works always and for my  
case is

sufficient.

Simply in WAR create a new class, implement the
ServletContextListener
interface and override contextInitialized method like this:

public void contextInitialized(ServletContextEvent ctx) {
String prefix = ctx.getServletContext().getRealPath("/");
String file =
ctx.getServletContext().getInitParameter("log4j-configuration- 
file");

if (file != null) {
DOMConfigurator.configure(prefix + "WEB-INF/" + file);
}
}

it works in G2.0.0 and G2.1

If You manage to use Log4j without this workaround, let me know
please ;)

best regards
Łukasz

On 27/02/2008, Jacek Laskowski <[EMAIL PROTECTED]> wrote:
On Tue, Feb 5, 2008 at 11:10 AM, Adam Ruggles  
<[EMAIL PROTECTED]>

wrote:


 I am also having this issue.  In tomcat I just needed a
log4j.xml in

my

 classpath, however geronimo seems to ignore it.

 The only solution I've found is to have Spring configure log4j

through the

 web.xml but that takes over all logging in geronimo.  I need to
have
 separate logging for each of my web apps.


 Have you tried to inverse-classloading and/or hidden-classes
elements
 in your plan so log4j and its configuration in Geronimo is for
 Geronimo stuff and yours is for your stuff?

 Jacek


 --
 Jacek Laskowski
 http://www.JacekLaskowski.pl






--
View this message in context: http://www.nabble.com/Geronimo-2-
Log4j-question-tp12865061s134p15879047.html
Sent from the Apache Geronimo - Users mailing list archive at
Nabble.com.







--
View this message in context: http://www.nabble.com/Geronimo-2- 
Log4j-question-tp12865061s134p15882415.html
Sent from the Apache Geronimo - Users mailing list archive at  
Nabble.com.






Re: Geronimo 2/Log4j question

2008-03-06 Thread Adam Ruggles

The problem with the ServletContextListener approach is that it takes over
the log4j for all apps.

For instance, I have two web apps running in geronimo.  They share a common
code base.  I need each one to manage their own logging.  Right now using
the Listener approach, the following occurs.

WebApp 1 starts up and begins logging com.my.package

Everything looks good so far.

WebApp2 starts up and begins logging com.my.package.  Now WebApp 1 is no
longer writing out to the log files and WebApp2's logs contains logging
information from WebApp1 and WebApp2.

By the way in both cases the geronimo.log file is affected as well.


djencks wrote:
> 
> The solution I know of is to include a log4j.properties file if you  
> want to run on servers that do not use log4j internally but to have  
> your ServletContextListener read an app specific properties file that  
> sets up the appender for your app and other such customizations and  
> feeds the info to log4j programatically.
> 
> Roller uses this technique.
> 
> I'm not sure exactly what the log4j API for this is and have to run  
> now, if you can't find it I can look more later.
> thanks
> david jencks
> 
> On Mar 6, 2008, at 9:22 AM, Adam Ruggles wrote:
> 
>>
>> I used Spring to create the listener like you've described here.   
>> It works,
>> but the only problem is that I have multiple web apps and I'd like  
>> them to
>> maintain their own log, however using this method causes the last  
>> web app to
>> load to take over the logging.
>>
>>
>>
>> Łukasz Budnik wrote:
>>>
>>> Hi!
>>>
>>> I had the very same problem with G2.0.0, currently I'm using G2.1 and
>>> to tell the truth I don't know whether this issue still exists  
>>> because
>>> I use a very simple work around that works always and for my case is
>>> sufficient.
>>>
>>> Simply in WAR create a new class, implement the  
>>> ServletContextListener
>>> interface and override contextInitialized method like this:
>>>
>>> public void contextInitialized(ServletContextEvent ctx) {
>>> String prefix = ctx.getServletContext().getRealPath("/");
>>> String file =
>>> ctx.getServletContext().getInitParameter("log4j-configuration-file");
>>> if (file != null) {
>>> DOMConfigurator.configure(prefix + "WEB-INF/" + file);
>>> }
>>> }
>>>
>>> it works in G2.0.0 and G2.1
>>>
>>> If You manage to use Log4j without this workaround, let me know  
>>> please ;)
>>>
>>> best regards
>>> Łukasz
>>>
>>> On 27/02/2008, Jacek Laskowski <[EMAIL PROTECTED]> wrote:
>>>> On Tue, Feb 5, 2008 at 11:10 AM, Adam Ruggles <[EMAIL PROTECTED]>
>>>> wrote:
>>>>>
>>>>>  I am also having this issue.  In tomcat I just needed a  
>>>>> log4j.xml in
>>>> my
>>>>>  classpath, however geronimo seems to ignore it.
>>>>>
>>>>>  The only solution I've found is to have Spring configure log4j
>>>> through the
>>>>>  web.xml but that takes over all logging in geronimo.  I need to  
>>>>> have
>>>>>  separate logging for each of my web apps.
>>>>
>>>>  Have you tried to inverse-classloading and/or hidden-classes  
>>>> elements
>>>>  in your plan so log4j and its configuration in Geronimo is for
>>>>  Geronimo stuff and yours is for your stuff?
>>>>
>>>>  Jacek
>>>>
>>>>
>>>>  --
>>>>  Jacek Laskowski
>>>>  http://www.JacekLaskowski.pl
>>>>
>>>
>>>
>>
>> -- 
>> View this message in context: http://www.nabble.com/Geronimo-2- 
>> Log4j-question-tp12865061s134p15879047.html
>> Sent from the Apache Geronimo - Users mailing list archive at  
>> Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Geronimo-2-Log4j-question-tp12865061s134p15882415.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: Geronimo 2/Log4j question

2008-03-06 Thread David Jencks
The solution I know of is to include a log4j.properties file if you  
want to run on servers that do not use log4j internally but to have  
your ServletContextListener read an app specific properties file that  
sets up the appender for your app and other such customizations and  
feeds the info to log4j programatically.


Roller uses this technique.

I'm not sure exactly what the log4j API for this is and have to run  
now, if you can't find it I can look more later.

thanks
david jencks

On Mar 6, 2008, at 9:22 AM, Adam Ruggles wrote:



I used Spring to create the listener like you've described here.   
It works,
but the only problem is that I have multiple web apps and I'd like  
them to
maintain their own log, however using this method causes the last  
web app to

load to take over the logging.



Łukasz Budnik wrote:


Hi!

I had the very same problem with G2.0.0, currently I'm using G2.1 and
to tell the truth I don't know whether this issue still exists  
because

I use a very simple work around that works always and for my case is
sufficient.

Simply in WAR create a new class, implement the  
ServletContextListener

interface and override contextInitialized method like this:

public void contextInitialized(ServletContextEvent ctx) {
String prefix = ctx.getServletContext().getRealPath("/");
String file =
ctx.getServletContext().getInitParameter("log4j-configuration-file");
if (file != null) {
DOMConfigurator.configure(prefix + "WEB-INF/" + file);
}
}

it works in G2.0.0 and G2.1

If You manage to use Log4j without this workaround, let me know  
please ;)


best regards
Łukasz

On 27/02/2008, Jacek Laskowski <[EMAIL PROTECTED]> wrote:

On Tue, Feb 5, 2008 at 11:10 AM, Adam Ruggles <[EMAIL PROTECTED]>
wrote:


 I am also having this issue.  In tomcat I just needed a  
log4j.xml in

my

 classpath, however geronimo seems to ignore it.

 The only solution I've found is to have Spring configure log4j

through the
 web.xml but that takes over all logging in geronimo.  I need to  
have

 separate logging for each of my web apps.


 Have you tried to inverse-classloading and/or hidden-classes  
elements

 in your plan so log4j and its configuration in Geronimo is for
 Geronimo stuff and yours is for your stuff?

 Jacek


 --
 Jacek Laskowski
 http://www.JacekLaskowski.pl






--
View this message in context: http://www.nabble.com/Geronimo-2- 
Log4j-question-tp12865061s134p15879047.html
Sent from the Apache Geronimo - Users mailing list archive at  
Nabble.com.






Re: Geronimo 2/Log4j question

2008-03-06 Thread Adam Ruggles

I used Spring to create the listener like you've described here.  It works,
but the only problem is that I have multiple web apps and I'd like them to
maintain their own log, however using this method causes the last web app to
load to take over the logging.



Łukasz Budnik wrote:
> 
> Hi!
> 
> I had the very same problem with G2.0.0, currently I'm using G2.1 and
> to tell the truth I don't know whether this issue still exists because
> I use a very simple work around that works always and for my case is
> sufficient.
> 
> Simply in WAR create a new class, implement the ServletContextListener
> interface and override contextInitialized method like this:
> 
> public void contextInitialized(ServletContextEvent ctx) {
>   String prefix = ctx.getServletContext().getRealPath("/");
>   String file =
> ctx.getServletContext().getInitParameter("log4j-configuration-file");
>   if (file != null) {
>   DOMConfigurator.configure(prefix + "WEB-INF/" + file);
>   }
>   }
> 
> it works in G2.0.0 and G2.1
> 
> If You manage to use Log4j without this workaround, let me know please ;)
> 
> best regards
> Łukasz
> 
> On 27/02/2008, Jacek Laskowski <[EMAIL PROTECTED]> wrote:
>> On Tue, Feb 5, 2008 at 11:10 AM, Adam Ruggles <[EMAIL PROTECTED]>
>> wrote:
>>  >
>>  >  I am also having this issue.  In tomcat I just needed a log4j.xml in
>> my
>>  >  classpath, however geronimo seems to ignore it.
>>  >
>>  >  The only solution I've found is to have Spring configure log4j
>> through the
>>  >  web.xml but that takes over all logging in geronimo.  I need to have
>>  >  separate logging for each of my web apps.
>>
>>  Have you tried to inverse-classloading and/or hidden-classes elements
>>  in your plan so log4j and its configuration in Geronimo is for
>>  Geronimo stuff and yours is for your stuff?
>>
>>  Jacek
>>
>>
>>  --
>>  Jacek Laskowski
>>  http://www.JacekLaskowski.pl
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Geronimo-2-Log4j-question-tp12865061s134p15879047.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: Geronimo 2/Log4j question

2008-03-06 Thread Adam Ruggles

I've tried both and neither works.



Jacek Laskowski wrote:
> 
> On Tue, Feb 5, 2008 at 11:10 AM, Adam Ruggles <[EMAIL PROTECTED]> wrote:
>>
>>  I am also having this issue.  In tomcat I just needed a log4j.xml in my
>>  classpath, however geronimo seems to ignore it.
>>
>>  The only solution I've found is to have Spring configure log4j through
>> the
>>  web.xml but that takes over all logging in geronimo.  I need to have
>>  separate logging for each of my web apps.
> 
> Have you tried to inverse-classloading and/or hidden-classes elements
> in your plan so log4j and its configuration in Geronimo is for
> Geronimo stuff and yours is for your stuff?
> 
> Jacek
> 
> -- 
> Jacek Laskowski
> http://www.JacekLaskowski.pl
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Geronimo-2-Log4j-question-tp12865061s134p15878908.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: Geronimo 2/Log4j question

2008-02-27 Thread Łukasz Budnik
Hi!

I had the very same problem with G2.0.0, currently I'm using G2.1 and
to tell the truth I don't know whether this issue still exists because
I use a very simple work around that works always and for my case is
sufficient.

Simply in WAR create a new class, implement the ServletContextListener
interface and override contextInitialized method like this:

public void contextInitialized(ServletContextEvent ctx) {
String prefix = ctx.getServletContext().getRealPath("/");
String file =
ctx.getServletContext().getInitParameter("log4j-configuration-file");
if (file != null) {
DOMConfigurator.configure(prefix + "WEB-INF/" + file);
}
}

it works in G2.0.0 and G2.1

If You manage to use Log4j without this workaround, let me know please ;)

best regards
Łukasz

On 27/02/2008, Jacek Laskowski <[EMAIL PROTECTED]> wrote:
> On Tue, Feb 5, 2008 at 11:10 AM, Adam Ruggles <[EMAIL PROTECTED]> wrote:
>  >
>  >  I am also having this issue.  In tomcat I just needed a log4j.xml in my
>  >  classpath, however geronimo seems to ignore it.
>  >
>  >  The only solution I've found is to have Spring configure log4j through the
>  >  web.xml but that takes over all logging in geronimo.  I need to have
>  >  separate logging for each of my web apps.
>
>  Have you tried to inverse-classloading and/or hidden-classes elements
>  in your plan so log4j and its configuration in Geronimo is for
>  Geronimo stuff and yours is for your stuff?
>
>  Jacek
>
>
>  --
>  Jacek Laskowski
>  http://www.JacekLaskowski.pl
>


Re: Geronimo 2/Log4j question

2008-02-26 Thread Jacek Laskowski
On Tue, Feb 5, 2008 at 11:10 AM, Adam Ruggles <[EMAIL PROTECTED]> wrote:
>
>  I am also having this issue.  In tomcat I just needed a log4j.xml in my
>  classpath, however geronimo seems to ignore it.
>
>  The only solution I've found is to have Spring configure log4j through the
>  web.xml but that takes over all logging in geronimo.  I need to have
>  separate logging for each of my web apps.

Have you tried to inverse-classloading and/or hidden-classes elements
in your plan so log4j and its configuration in Geronimo is for
Geronimo stuff and yours is for your stuff?

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl


Re: Geronimo 2/Log4j question

2008-02-05 Thread Adam Ruggles

I am also having this issue.  In tomcat I just needed a log4j.xml in my
classpath, however geronimo seems to ignore it.

The only solution I've found is to have Spring configure log4j through the
web.xml but that takes over all logging in geronimo.  I need to have
separate logging for each of my web apps.

Has anyone figured out a way to get this working?


Java_James wrote:
> 
> Hi all,
> 
> I tried searching for an answer on this one, but couldnt find anything.  
> 
> I'm using geronimo 2, struts 2 and the latest log4j package.  I've
> deployed an ear file with an ejb jar and a war file.
> 
> For the most part, everything works just fine.  However, despite the fact
> that I have my log4j.xml in the WEB-INF/classes folder, the app is picking
> up the logging for geronimo instead of for my app.  
> 
> Is there something special I have to do for it to use the logging config
> in my war?  I don't really want all my logs in geronimo.out
> 
> Thanks in advance.
> 

-- 
View this message in context: 
http://www.nabble.com/Geronimo-2-Log4j-question-tp12865061s134p15297350.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Geronimo 2/Log4j question

2007-09-24 Thread Java_James

Hi all,

I tried searching for an answer on this one, but couldnt find anything.  

I'm using geronimo 2, struts 2 and the latest log4j package.  I've deployed
an ear file with an ejb jar and a war file.

For the most part, everything works just fine.  However, despite the fact
that I have my log4j.xml in the WEB-INF/classes folder, the app is picking
up the logging for geronimo instead of for my app.  

Is there something special I have to do for it to use the logging config in
my war?  I don't really want all my logs in geronimo.out

Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/Geronimo-2-Log4j-question-tf4510784s134.html#a12865061
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.