Change WebApp Log4J Directory

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Change WebApp Log4J Directory

Nuno A
Hello.

How can I change the default Log4J directory for the WebApp without passing "-D" for the JVM, and without restarting Tomcat ?

Thanks and regards,

Nuno A.
Reply | Threaded
Open this post in threaded view
|

Re: Change WebApp Log4J Directory

Dawid Weiss-2

If you're running Carrot2 webapp, modify the default log4j configuration inside
the WAR file (WEB-INF/classes/log4j.xml) and redeploy the webapp. Should work.

Dawid

Nuno A wrote:
> Hello.
>
> How can I change the default Log4J directory for the WebApp without passing
> "-D" for the JVM, and without restarting Tomcat ?
>
> Thanks and regards,
>
> Nuno A.
>

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Carrot2-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/carrot2-developers
Reply | Threaded
Open this post in threaded view
|

Re: Change WebApp Log4J Directory

Nuno A
Hi Dawid,

can you please give me an example ?

I saw that the log appenders are coded in the LogInitContextListener class, which in turn reads the SystemProperty "carrot2.logs".

Can this property be defined in the log4j.xml ?


Thanks and regards,

Nuno


JIRA dawid.weiss@cs.put.poznan.pl wrote
If you're running Carrot2 webapp, modify the default log4j configuration inside
the WAR file (WEB-INF/classes/log4j.xml) and redeploy the webapp. Should work.

Dawid
Reply | Threaded
Open this post in threaded view
|

Re: Change WebApp Log4J Directory

Dawid Weiss-2

> I saw that the log appenders are coded in the LogInitContextListener class,
> which in turn reads the SystemProperty "carrot2.logs".

Ah, that's right. I forgot we changed it a while back. Can you explain what your
problem is, though? Do you need to redirect logs without administrative access
to Tomcat?

> Can this property be defined in the log4j.xml ?

No, this property is only read from system properties. But we only append our
custom appenders to our own loggers, so you can still write up a custom log4j
configuration (including any appenders you may wish to configure) and redirect
logs to some other location.

You can find examples of Log4j configurations on the web.

Dawid

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Carrot2-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/carrot2-developers
Reply | Threaded
Open this post in threaded view
|

Re: Change WebApp Log4J Directory

Nuno A

JIRA dawid.weiss@cs.put.poznan.pl wrote
Ah, that's right. I forgot we changed it a while back. Can you explain what your
problem is, though? Do you need to redirect logs without administrative access
to Tomcat?
Yes, I need to redirect logs without administrative rights.

Logs says this:

$ head -20 localhost.2009-03-15.log

Mar 15, 2009 3:35:21 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'
Mar 15, 2009 3:35:28 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: start: Starting web application at '/carrot2-webapp'
Mar 15, 2009 3:35:28 PM org.apache.catalina.core.StandardContext
listenerStart
SEVERE: Exception sending context initialized event to listener instance of
class org.carrot2.webapp.LogInitContextListener
java.security.AccessControlException: access denied
(java.util.PropertyPermission carrot2.logs read)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:342)
at
java.security.AccessController.checkPermission(AccessController.java:553)
at
java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at
java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1302)
at java.lang.System.getProperty(System.java:669)
at
org.carrot2.webapp.LogInitContextListener.getLogDir(LogInitContextListener.java:161)
at
org.carrot2.webapp.LogInitContextListener.addAppenders(LogInitContextListener.java:114)
at
org.carrot2.webapp.LogInitContextListener.contextInitialized(LogInitContextListener.java:74)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at
org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1247)
at
org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:604)
at
org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:129)


guess it's a problem with   getSystemProperty("carrot2.logs")
and some Java Policy.

JIRA dawid.weiss@cs.put.poznan.pl wrote
No, this property is only read from system properties. But we only append our
custom appenders to our own loggers, so you can still write up a custom log4j
configuration (including any appenders you may wish to configure) and redirect
logs to some other location.
I guess I will have to rewrite a custom Log Initializer that doesn't uses   getSystemProperties().

JIRA dawid.weiss@cs.put.poznan.pl wrote
You can find examples of Log4j configurations on the web.
I looked for a while but still didn't found any usefull example, because the appenders are defined in the mentioned LogInitContextListener Java Class.


Thanks and regards,

Nuno A.
Reply | Threaded
Open this post in threaded view
|

Re: Change WebApp Log4J Directory

Dawid Weiss-2

This means tomcat runs with security manager. I'm afraid you won't be able to
run Carrot2 webapp with security manager turned on (we don't use it and we don't
test against such a configuration).

Logging is the least of your problems, sorry.

Dawid

Nuno A wrote:

>
>
> JIRA [hidden email] wrote:
>>
>> Ah, that's right. I forgot we changed it a while back. Can you explain
>> what your
>> problem is, though? Do you need to redirect logs without administrative
>> access
>> to Tomcat?
>>
>>
>
> Yes, I need to redirect logs without administrative rights.
>
> Logs says this:
>
> $ head -20 localhost.2009-03-15.log
>
> Mar 15, 2009 3:35:21 PM org.apache.catalina.core.ApplicationContext log
> INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'
> Mar 15, 2009 3:35:28 PM org.apache.catalina.core.ApplicationContext log
> INFO: HTMLManager: start: Starting web application at '/carrot2-webapp'
> Mar 15, 2009 3:35:28 PM org.apache.catalina.core.StandardContext
> listenerStart
> SEVERE: Exception sending context initialized event to listener instance of
> class org.carrot2.webapp.LogInitContextListener
> java.security.AccessControlException: access denied
> (java.util.PropertyPermission carrot2.logs read)
> at
> java.security.AccessControlContext.checkPermission(AccessControlContext.java:342)
> at
> java.security.AccessController.checkPermission(AccessController.java:553)
> at
> java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
> at
> java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1302)
> at java.lang.System.getProperty(System.java:669)
> at
> org.carrot2.webapp.LogInitContextListener.getLogDir(LogInitContextListener.java:161)
> at
> org.carrot2.webapp.LogInitContextListener.addAppenders(LogInitContextListener.java:114)
> at
> org.carrot2.webapp.LogInitContextListener.contextInitialized(LogInitContextListener.java:74)
> at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
> at
> org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1247)
> at
> org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:604)
> at
> org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:129)
>
>
> guess it's a problem with   getSystemProperty("carrot2.logs")
> and some Java Policy.
>
>
> JIRA [hidden email] wrote:
>>
>> No, this property is only read from system properties. But we only append
>> our
>> custom appenders to our own loggers, so you can still write up a custom
>> log4j
>> configuration (including any appenders you may wish to configure) and
>> redirect
>> logs to some other location.
>>
>>
>
> I guess I will have to rewrite a custom Log Initializer that doesn't uses  
> getSystemProperties().
>
>
> JIRA [hidden email] wrote:
>>
>> You can find examples of Log4j configurations on the web.
>>
>
> I looked for a while but still didn't found any usefull example, because the
> appenders are defined in the mentioned LogInitContextListener Java Class.
>
>
> Thanks and regards,
>
> Nuno A.
>

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Carrot2-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/carrot2-developers