You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Sathwik <sa...@apache.org> on 2016/11/04 07:47:20 UTC

How to enable Catalina logs when using Embedded Tomee

Hi,

The application is packaged with SLF4J + Log4j2 and starts Tomee 7.0.1 embedded container. Is there a way to enable catalina logs.

regards,
sathwik

Re: How to enable Catalina logs when using Embedded Tomee

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2016-11-04 12:23 GMT+01:00 Sathwik <sa...@apache.org>:

> Ah,
> Thanks for clarifying it. By the way, I was looking to get the normal
> catalina.log, access.log and other logs that Tomcat usually generates.
>
>
Ok, with plain JUL just set on the JVM in your start.sh the JUL(i)
logging.properties you want to use and optionnally the LogManager (that's
system properties on the JVM).

The access log depends the access log valve set on the server. TomEE should
let you getTomcat() instance from the container and add valves on its host
for that.


> I can see now that  tomcat is started and then SystemInstance is
> initialized
>
> https://github.com/apache/tomee/blob/tomee-7.0.1/tomee/
> tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java#L591
>
> https://github.com/apache/tomee/blob/tomee-7.0.1/tomee/
> tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java#L646
>
> regards,
> sathwik
>
> On 2016-11-04 15:19 (+0530), Romain Manni-Bucau <rm...@gmail.com>
> wrote:
> > (just repeating to ensure it is clear and you dont get me wrong: you
> didnt
> > mention explicitly what "doesnt work")
> >
> > TomEE-tomcat log setup works when tomee is initialized. Tomcat instance
> is
> > started a little bit before tomee/openejb starts (the 4-5 lines you see
> > using JUL). The test "is it started" is to check SystemInstance is
> > intialized and Logger is configured. If you init them manually before
> > starting tomee the first logs should be redirected to the configured
> > properties of Logger and then tomee will initialized properly but first
> > logs will have used the intended logger.
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://blog-rmannibucau.rhcloud.com> | Old Blog
> > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-11-04 10:35 GMT+01:00 Sathwik <sa...@apache.org>:
> >
> > > openejb.log.factory=slf4j
> > > is already set in system.properties and it is already in the classpath
> > >
> > > Do we need to explicitly initialize?
> > >  org.apache.openejb.loader.SystemInstance.init(properties);
> > >  org.apache.openejb.util.Logger.configure(properties);
> > >
> > >
> > > On 2016-11-04 14:32 (+0530), Romain Manni-Bucau <rmannibucau@gmail.com
> >
> > > wrote:
> > > > is it about the 4-5 tomcat lines done through JUL? Wonder if it still
> > > > happens on 7.0.2-SNAPSHOT.
> > > >
> > > > Anyway a workaround since you are bound to tomee:
> > > >
> > > > org.apache.openejb.loader.SystemInstance.init(properties);
> > > > org.apache.openejb.util.Logger.configure(properties);
> > > >
> > > > ensure to put in properties you setup openejb.log.factory=slf4j
> > > >
> > > >
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <https://blog-rmannibucau.rhcloud.com> | Old Blog
> > > > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> > > rmannibucau> |
> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> > > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > > >
> > > > 2016-11-04 9:16 GMT+01:00 Sathwik <sa...@apache.org>:
> > > >
> > > > > Here is the packaged server
> > > > > https://repository.apache.org/content/groups/snapshots/org/
> > > > > apache/ode/ode-tomee-server/1.3.7-SNAPSHOT/ode-tomee-server-
> > > > > 1.3.7-SNAPSHOT.zip
> > > > >
> > > > > server startup script is under bin/start.sh
> > > > > tomee configuration files is under conf/
> > > > >
> > > > > openejb.log.factory=slf4j
> > > > > conf/log4j2.xml
> > > > >
> > > > > Would it be possible for you to have a check?
> > > > >
> > > > > On 2016-11-04 13:31 (+0530), Romain Manni-Bucau <
> rmannibucau@gmail.com
> > > >
> > > > > wrote:
> > > > > > Is the question about log4j2? if so you can set
> > > > > openejb.log.factory=log4j2,
> > > > > > if not and you rely on JUL you rely on the *JVM* (not tomcat)
> > > settings
> > > > > and
> > > > > > standard JUL configuration.
> > > > > >
> > > > > >
> > > > > > Romain Manni-Bucau
> > > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > > <https://blog-rmannibucau.rhcloud.com> | Old Blog
> > > > > > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> > > > > rmannibucau> |
> > > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE
> Factory
> > > > > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > > > > >
> > > > > > 2016-11-04 8:47 GMT+01:00 Sathwik <sa...@apache.org>:
> > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > The application is packaged with SLF4J + Log4j2 and starts
> Tomee
> > > 7.0.1
> > > > > > > embedded container. Is there a way to enable catalina logs.
> > > > > > >
> > > > > > > regards,
> > > > > > > sathwik
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: How to enable Catalina logs when using Embedded Tomee

Posted by Sathwik <sa...@apache.org>.
Ah, 
Thanks for clarifying it. By the way, I was looking to get the normal catalina.log, access.log and other logs that Tomcat usually generates.

I can see now that  tomcat is started and then SystemInstance is initialized

https://github.com/apache/tomee/blob/tomee-7.0.1/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java#L591

https://github.com/apache/tomee/blob/tomee-7.0.1/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java#L646

regards,
sathwik

On 2016-11-04 15:19 (+0530), Romain Manni-Bucau <rm...@gmail.com> wrote: 
> (just repeating to ensure it is clear and you dont get me wrong: you didnt
> mention explicitly what "doesnt work")
> 
> TomEE-tomcat log setup works when tomee is initialized. Tomcat instance is
> started a little bit before tomee/openejb starts (the 4-5 lines you see
> using JUL). The test "is it started" is to check SystemInstance is
> intialized and Logger is configured. If you init them manually before
> starting tomee the first logs should be redirected to the configured
> properties of Logger and then tomee will initialized properly but first
> logs will have used the intended logger.
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-11-04 10:35 GMT+01:00 Sathwik <sa...@apache.org>:
> 
> > openejb.log.factory=slf4j
> > is already set in system.properties and it is already in the classpath
> >
> > Do we need to explicitly initialize?
> >  org.apache.openejb.loader.SystemInstance.init(properties);
> >  org.apache.openejb.util.Logger.configure(properties);
> >
> >
> > On 2016-11-04 14:32 (+0530), Romain Manni-Bucau <rm...@gmail.com>
> > wrote:
> > > is it about the 4-5 tomcat lines done through JUL? Wonder if it still
> > > happens on 7.0.2-SNAPSHOT.
> > >
> > > Anyway a workaround since you are bound to tomee:
> > >
> > > org.apache.openejb.loader.SystemInstance.init(properties);
> > > org.apache.openejb.util.Logger.configure(properties);
> > >
> > > ensure to put in properties you setup openejb.log.factory=slf4j
> > >
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <https://blog-rmannibucau.rhcloud.com> | Old Blog
> > > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> > rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > >
> > > 2016-11-04 9:16 GMT+01:00 Sathwik <sa...@apache.org>:
> > >
> > > > Here is the packaged server
> > > > https://repository.apache.org/content/groups/snapshots/org/
> > > > apache/ode/ode-tomee-server/1.3.7-SNAPSHOT/ode-tomee-server-
> > > > 1.3.7-SNAPSHOT.zip
> > > >
> > > > server startup script is under bin/start.sh
> > > > tomee configuration files is under conf/
> > > >
> > > > openejb.log.factory=slf4j
> > > > conf/log4j2.xml
> > > >
> > > > Would it be possible for you to have a check?
> > > >
> > > > On 2016-11-04 13:31 (+0530), Romain Manni-Bucau <rmannibucau@gmail.com
> > >
> > > > wrote:
> > > > > Is the question about log4j2? if so you can set
> > > > openejb.log.factory=log4j2,
> > > > > if not and you rely on JUL you rely on the *JVM* (not tomcat)
> > settings
> > > > and
> > > > > standard JUL configuration.
> > > > >
> > > > >
> > > > > Romain Manni-Bucau
> > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > <https://blog-rmannibucau.rhcloud.com> | Old Blog
> > > > > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> > > > rmannibucau> |
> > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> > > > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > > > >
> > > > > 2016-11-04 8:47 GMT+01:00 Sathwik <sa...@apache.org>:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > The application is packaged with SLF4J + Log4j2 and starts Tomee
> > 7.0.1
> > > > > > embedded container. Is there a way to enable catalina logs.
> > > > > >
> > > > > > regards,
> > > > > > sathwik
> > > > > >
> > > > >
> > > >
> > >
> >
> 

Re: How to enable Catalina logs when using Embedded Tomee

Posted by Romain Manni-Bucau <rm...@gmail.com>.
(just repeating to ensure it is clear and you dont get me wrong: you didnt
mention explicitly what "doesnt work")

TomEE-tomcat log setup works when tomee is initialized. Tomcat instance is
started a little bit before tomee/openejb starts (the 4-5 lines you see
using JUL). The test "is it started" is to check SystemInstance is
intialized and Logger is configured. If you init them manually before
starting tomee the first logs should be redirected to the configured
properties of Logger and then tomee will initialized properly but first
logs will have used the intended logger.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-11-04 10:35 GMT+01:00 Sathwik <sa...@apache.org>:

> openejb.log.factory=slf4j
> is already set in system.properties and it is already in the classpath
>
> Do we need to explicitly initialize?
>  org.apache.openejb.loader.SystemInstance.init(properties);
>  org.apache.openejb.util.Logger.configure(properties);
>
>
> On 2016-11-04 14:32 (+0530), Romain Manni-Bucau <rm...@gmail.com>
> wrote:
> > is it about the 4-5 tomcat lines done through JUL? Wonder if it still
> > happens on 7.0.2-SNAPSHOT.
> >
> > Anyway a workaround since you are bound to tomee:
> >
> > org.apache.openejb.loader.SystemInstance.init(properties);
> > org.apache.openejb.util.Logger.configure(properties);
> >
> > ensure to put in properties you setup openejb.log.factory=slf4j
> >
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://blog-rmannibucau.rhcloud.com> | Old Blog
> > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-11-04 9:16 GMT+01:00 Sathwik <sa...@apache.org>:
> >
> > > Here is the packaged server
> > > https://repository.apache.org/content/groups/snapshots/org/
> > > apache/ode/ode-tomee-server/1.3.7-SNAPSHOT/ode-tomee-server-
> > > 1.3.7-SNAPSHOT.zip
> > >
> > > server startup script is under bin/start.sh
> > > tomee configuration files is under conf/
> > >
> > > openejb.log.factory=slf4j
> > > conf/log4j2.xml
> > >
> > > Would it be possible for you to have a check?
> > >
> > > On 2016-11-04 13:31 (+0530), Romain Manni-Bucau <rmannibucau@gmail.com
> >
> > > wrote:
> > > > Is the question about log4j2? if so you can set
> > > openejb.log.factory=log4j2,
> > > > if not and you rely on JUL you rely on the *JVM* (not tomcat)
> settings
> > > and
> > > > standard JUL configuration.
> > > >
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <https://blog-rmannibucau.rhcloud.com> | Old Blog
> > > > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> > > rmannibucau> |
> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> > > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > > >
> > > > 2016-11-04 8:47 GMT+01:00 Sathwik <sa...@apache.org>:
> > > >
> > > > > Hi,
> > > > >
> > > > > The application is packaged with SLF4J + Log4j2 and starts Tomee
> 7.0.1
> > > > > embedded container. Is there a way to enable catalina logs.
> > > > >
> > > > > regards,
> > > > > sathwik
> > > > >
> > > >
> > >
> >
>

Re: How to enable Catalina logs when using Embedded Tomee

Posted by Sathwik <sa...@apache.org>.
openejb.log.factory=slf4j 
is already set in system.properties and it is already in the classpath

Do we need to explicitly initialize?
 org.apache.openejb.loader.SystemInstance.init(properties);
 org.apache.openejb.util.Logger.configure(properties);


On 2016-11-04 14:32 (+0530), Romain Manni-Bucau <rm...@gmail.com> wrote: 
> is it about the 4-5 tomcat lines done through JUL? Wonder if it still
> happens on 7.0.2-SNAPSHOT.
> 
> Anyway a workaround since you are bound to tomee:
> 
> org.apache.openejb.loader.SystemInstance.init(properties);
> org.apache.openejb.util.Logger.configure(properties);
> 
> ensure to put in properties you setup openejb.log.factory=slf4j
> 
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-11-04 9:16 GMT+01:00 Sathwik <sa...@apache.org>:
> 
> > Here is the packaged server
> > https://repository.apache.org/content/groups/snapshots/org/
> > apache/ode/ode-tomee-server/1.3.7-SNAPSHOT/ode-tomee-server-
> > 1.3.7-SNAPSHOT.zip
> >
> > server startup script is under bin/start.sh
> > tomee configuration files is under conf/
> >
> > openejb.log.factory=slf4j
> > conf/log4j2.xml
> >
> > Would it be possible for you to have a check?
> >
> > On 2016-11-04 13:31 (+0530), Romain Manni-Bucau <rm...@gmail.com>
> > wrote:
> > > Is the question about log4j2? if so you can set
> > openejb.log.factory=log4j2,
> > > if not and you rely on JUL you rely on the *JVM* (not tomcat) settings
> > and
> > > standard JUL configuration.
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <https://blog-rmannibucau.rhcloud.com> | Old Blog
> > > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> > rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > >
> > > 2016-11-04 8:47 GMT+01:00 Sathwik <sa...@apache.org>:
> > >
> > > > Hi,
> > > >
> > > > The application is packaged with SLF4J + Log4j2 and starts Tomee 7.0.1
> > > > embedded container. Is there a way to enable catalina logs.
> > > >
> > > > regards,
> > > > sathwik
> > > >
> > >
> >
> 

Re: How to enable Catalina logs when using Embedded Tomee

Posted by Romain Manni-Bucau <rm...@gmail.com>.
is it about the 4-5 tomcat lines done through JUL? Wonder if it still
happens on 7.0.2-SNAPSHOT.

Anyway a workaround since you are bound to tomee:

org.apache.openejb.loader.SystemInstance.init(properties);
org.apache.openejb.util.Logger.configure(properties);

ensure to put in properties you setup openejb.log.factory=slf4j



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-11-04 9:16 GMT+01:00 Sathwik <sa...@apache.org>:

> Here is the packaged server
> https://repository.apache.org/content/groups/snapshots/org/
> apache/ode/ode-tomee-server/1.3.7-SNAPSHOT/ode-tomee-server-
> 1.3.7-SNAPSHOT.zip
>
> server startup script is under bin/start.sh
> tomee configuration files is under conf/
>
> openejb.log.factory=slf4j
> conf/log4j2.xml
>
> Would it be possible for you to have a check?
>
> On 2016-11-04 13:31 (+0530), Romain Manni-Bucau <rm...@gmail.com>
> wrote:
> > Is the question about log4j2? if so you can set
> openejb.log.factory=log4j2,
> > if not and you rely on JUL you rely on the *JVM* (not tomcat) settings
> and
> > standard JUL configuration.
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://blog-rmannibucau.rhcloud.com> | Old Blog
> > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-11-04 8:47 GMT+01:00 Sathwik <sa...@apache.org>:
> >
> > > Hi,
> > >
> > > The application is packaged with SLF4J + Log4j2 and starts Tomee 7.0.1
> > > embedded container. Is there a way to enable catalina logs.
> > >
> > > regards,
> > > sathwik
> > >
> >
>

Re: How to enable Catalina logs when using Embedded Tomee

Posted by Sathwik <sa...@apache.org>.
Here is the packaged server
https://repository.apache.org/content/groups/snapshots/org/apache/ode/ode-tomee-server/1.3.7-SNAPSHOT/ode-tomee-server-1.3.7-SNAPSHOT.zip

server startup script is under bin/start.sh
tomee configuration files is under conf/

openejb.log.factory=slf4j
conf/log4j2.xml

Would it be possible for you to have a check?

On 2016-11-04 13:31 (+0530), Romain Manni-Bucau <rm...@gmail.com> wrote: 
> Is the question about log4j2? if so you can set openejb.log.factory=log4j2,
> if not and you rely on JUL you rely on the *JVM* (not tomcat) settings and
> standard JUL configuration.
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-11-04 8:47 GMT+01:00 Sathwik <sa...@apache.org>:
> 
> > Hi,
> >
> > The application is packaged with SLF4J + Log4j2 and starts Tomee 7.0.1
> > embedded container. Is there a way to enable catalina logs.
> >
> > regards,
> > sathwik
> >
> 

Re: How to enable Catalina logs when using Embedded Tomee

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Is the question about log4j2? if so you can set openejb.log.factory=log4j2,
if not and you rely on JUL you rely on the *JVM* (not tomcat) settings and
standard JUL configuration.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-11-04 8:47 GMT+01:00 Sathwik <sa...@apache.org>:

> Hi,
>
> The application is packaged with SLF4J + Log4j2 and starts Tomee 7.0.1
> embedded container. Is there a way to enable catalina logs.
>
> regards,
> sathwik
>