https://issues.apache.org/bugzilla/show_bug.cgi?id=53137

             Bug #: 53137
           Summary: Can't use |bin/rotatelogs in conjunction with
                    org.apache.jk.config.ApacheConfig
           Product: Tomcat 6
           Version: 6.0.26
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: esmond.p...@bigpond.com
    Classification: Unclassified


The org.apache.jk.config.ApacheConfig class assumes that the value of the jkLog
parameter is a filename, and attempts to validate it by constructing a File
object.

However the Apache HTTPD which uses the output of this class also allows a pipe
syntax which allows for rolling log files, e.g. JkLogFile="|bin/rotatelogs.exe
logs/mod_jk.%Y-%m-%d.log 86400".

So the ApacheConfig class prevents the use of this valuable feature. It should
do one of two things:

1. Not check directory existence if the pipe "|" syntax is present

or better still:

2. Not check directory existence *at all*. Tomcat doesn't need the directory to
exist. It is Apache HTTPD that needs the logfile directory to exist, not
Tomcat, and failures in the Apache HTTPD configuration should be detected and
logged by Apache HTTPD, not by Tomcat. Note that if Tomcat detects the pipe
syntax it doesn't presently log the error at all, it just displays it on the
very transient startup screen. This is not really much use.

The server.xml required to produce this problem is as follows:

  <Listener
    className="org.apache.jk.config.ApacheConfig"
    configHome="C:/Program Files (x86)/Apache Software Foundation/Apache2.2/"
    modJk="modules/mod_jk.so"
    jkWorker="ajp13"
    jkLog="|bin/rotatelogs.exe logs/mod_jk.%Y-%m-%d.log 86400"
    jkDebug="info"
    />

The console output is as follows:

java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.RuntimeException: Unable to create path to config file
:C:\
Program Files (x86)\Apache Software Foundation\Apache2.2\|bin\rotatelogs.exe
log
s\mod_jk.%Y-%m-%d.log 86400
        at
org.apache.jk.config.BaseJkConfig.getConfigFile(BaseJkConfig.java:429
)
        at
org.apache.jk.config.ApacheConfig.initProperties(ApacheConfig.java:23
7)
        at org.apache.jk.config.BaseJkConfig.execute(BaseJkConfig.java:134)
        at
org.apache.jk.config.BaseJkConfig.lifecycleEvent(BaseJkConfig.java:12
5)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
        at
org.apache.catalina.core.StandardServer.start(StandardServer.java:703
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
        ... 6 more

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to