You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Didier Wiroth <dw...@gmail.com> on 2014/08/08 21:18:09 UTC

configuring tomcat 7, modify juli default configuration, doesn't work as expected

Hi,
(using tomcat x64 7.0.55 & java jvm 1.7.0_67-b01 on windows 8.1 x64)

I'm a tomcat amateur trying to setup tomcat with different service
containers and multihosting etc.

I would like to modify the default logging.properties to log the
appropriate files, but I doesn't work.

Here are the 2 service containers (serv1 & serv2) of my server.xml:

 <Service name="serv1">
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <Engine name="Catalina" defaultHost="serv1" jvmRoute="jvm1">
      <Realm className="org.apache.
catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
      </Realm>
      <Host name="serv1"  appBase="webapps" unpackWARs="true" autoDeploy="true">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="serv1_access." suffix=".log" pattern="%h %l
%u %t &quot;%r&quot; %s %b" />
      </Host>
    </Engine>
  </Service>

    <Service name="serv2">
    <Connector port="8081" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8444" />
    <Engine name="Catalina" defaultHost="serv2" jvmRoute="jvm2">
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
      </Realm>
      <Host name="serv2"  appBase="webapps.serv2" unpackWARs="true"
autoDeploy="true">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="serv2_access." suffix=".log" pattern="%h %l
%u %t &quot;%r&quot; %s %b" />
      </Host>
    </Engine>
  </Service>

I kept all the original entries conf/logging.properties
I only "added the following conf/logging properies.
a) added filehandlers (5serv1 & 6serv2)
handlers = 1catalina.org.apache.juli.FileHandler,
2localhost.org.apache.juli.FileHandler,
3manager.org.apache.juli.FileHandler,
4host-manager.org.apache.juli.FileHandler,
5serv1.org.apache.juli.FileHandler,
6serv2.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler

b) Here are the handler properties:

5serv1.org.apache.juli.FileHandler.level = FINE
5serv1.apache.juli.FileHandler.directory = ${catalina.base}/logs
5serv1.org.apache.juli.FileHandler.prefix = serv1.catalina.

6serv2.org.apache.juli.FileHandler.level = FINE
6serv2.apache.juli.FileHandler.directory = ${catalina.base}/logs
6serv2.org.apache.juli.FileHandler.prefix = serv2.catalina.

c) Here Facility specific properties:
org.apache.catalina.core.ContainerBase.[Catalina].[serv1].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[serv1].handlers =
5serv1.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[serv2].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[serv2].handlers =
6serv2.org.apache.juli.FileHandler

Unfortunately the 5serv1.catalina.x & 6serv2.catalina.y files are not
created, nothing is logged in these filehandlers.

Everything is still logged in the default filehandler:
1catalina.org.apache.juli.FileHandler

Why?
What am I doing wrong?

If you want, I can mail you my server.xml & logging.properties.

Thank you very much!


-- 
Didier Wiroth

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: configuring tomcat 7, modify juli default configuration, doesn't work as expected

Posted by Konstantin Kolinko <kn...@gmail.com>.
2014-08-08 23:18 GMT+04:00 Didier Wiroth <dw...@gmail.com>:
> Hi,
> (using tomcat x64 7.0.55 & java jvm 1.7.0_67-b01 on windows 8.1 x64)
>
> I'm a tomcat amateur trying to setup tomcat with different service
> containers and multihosting etc.
>
> I would like to modify the default logging.properties to log the
> appropriate files, but I doesn't work.
>
> Here are the 2 service containers (serv1 & serv2) of my server.xml:
>
>  <Service name="serv1">
>     <Connector port="8080" protocol="HTTP/1.1"
>                connectionTimeout="20000"
>                redirectPort="8443" />
>     <Engine name="Catalina" defaultHost="serv1" jvmRoute="jvm1">

1. The usual convention is to use the same name in <Service> and <Engine>.

I mean you would better use  <Engine name="serv1"> and in the same way
for the second Service/Engine pair.

>       <Realm className="org.apache.
> catalina.realm.LockOutRealm">
>         <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
> resourceName="UserDatabase"/>
>       </Realm>
>       <Host name="serv1"  appBase="webapps" unpackWARs="true" autoDeploy="true">
>         <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs" prefix="serv1_access." suffix=".log" pattern="%h %l
> %u %t &quot;%r&quot; %s %b" />
>       </Host>
>     </Engine>
>   </Service>
>
>     <Service name="serv2">
>     <Connector port="8081" protocol="HTTP/1.1"
>                connectionTimeout="20000"
>                redirectPort="8444" />
>     <Engine name="Catalina" defaultHost="serv2" jvmRoute="jvm2">
>       <Realm className="org.apache.catalina.realm.LockOutRealm">
>         <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
> resourceName="UserDatabase"/>
>       </Realm>
>       <Host name="serv2"  appBase="webapps.serv2" unpackWARs="true"
> autoDeploy="true">
>         <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs" prefix="serv2_access." suffix=".log" pattern="%h %l
> %u %t &quot;%r&quot; %s %b" />
>       </Host>
>     </Engine>
>   </Service>
>
> I kept all the original entries conf/logging.properties
> I only "added the following conf/logging properies.
> a) added filehandlers (5serv1 & 6serv2)
> handlers = 1catalina.org.apache.juli.FileHandler,
> 2localhost.org.apache.juli.FileHandler,
> 3manager.org.apache.juli.FileHandler,
> 4host-manager.org.apache.juli.FileHandler,
> 5serv1.org.apache.juli.FileHandler,
> 6serv2.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
> .handlers = 1catalina.org.apache.juli.FileHandler,
> java.util.logging.ConsoleHandler
>
> b) Here are the handler properties:
>
> 5serv1.org.apache.juli.FileHandler.level = FINE
> 5serv1.apache.juli.FileHandler.directory = ${catalina.base}/logs

2. The above property name is mistyped. It misses "org." before "apache".

Effectively it is ignored. The default value of that property of
FileHandler is "logs" in the current working directory of the program.

3. I hope that all the properties (such as "handlers" property above)
are actually written in one line, and the above wrapping is performed
by e-mail editor.

I do not see any other apparent issues with your configuration.

4. Do you have any web applications deployed?

Best regards,
Konstantin Kolinko

> 5serv1.org.apache.juli.FileHandler.prefix = serv1.catalina.
>
> 6serv2.org.apache.juli.FileHandler.level = FINE
> 6serv2.apache.juli.FileHandler.directory = ${catalina.base}/logs
> 6serv2.org.apache.juli.FileHandler.prefix = serv2.catalina.
>
> c) Here Facility specific properties:
> org.apache.catalina.core.ContainerBase.[Catalina].[serv1].level = INFO
> org.apache.catalina.core.ContainerBase.[Catalina].[serv1].handlers =
> 5serv1.org.apache.juli.FileHandler
>
> org.apache.catalina.core.ContainerBase.[Catalina].[serv2].level = INFO
> org.apache.catalina.core.ContainerBase.[Catalina].[serv2].handlers =
> 6serv2.org.apache.juli.FileHandler
>
> Unfortunately the 5serv1.catalina.x & 6serv2.catalina.y files are not
> created, nothing is logged in these filehandlers.
>
> Everything is still logged in the default filehandler:
> 1catalina.org.apache.juli.FileHandler
>
> Why?
> What am I doing wrong?
>
> If you want, I can mail you my server.xml & logging.properties.
>
> Thank you very much!
>
>
> --
> Didier Wiroth
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org