https://bz.apache.org/bugzilla/show_bug.cgi?id=69584

Konstantin Kolinko <knst.koli...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
             Status|RESOLVED                    |REOPENED

--- Comment #6 from Konstantin Kolinko <knst.koli...@gmail.com> ---
I am -1 to Dimitris's changes of the scripts in
https://github.com/apache/tomcat/commit/79e4d27450d67103b19e31a9040bfe5f2234e671


I am pretty sure that the "stop" command SHOULD NOT use the same logging
configuration as the main instance of Tomcat.

Note that the stop command spawns a short-lived separate process (that connects
to the shutdown port, sends the text of shutdown command and exits). I see no
good reason for it to open all the same log files as the main process, as it
results in two processes actively writing to the same files at the same time.

The idea is that the "stop" process uses the default logging configuration (as
provided by JRE), and that essentially means logging to the console. As with
any other standalone java program.



(In reply to K from comment #0)
> 
> Configuration error
> java.io.FileNotFoundException: /lib/logging.properties (No such file or
> directory)
>        at java.base/java.io.FileInputStream.open0(Native Method)
>        at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
>        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
>        at
> org.apache.juli.ClassLoaderLogManager.
> readConfiguration(ClassLoaderLogManager.java:479)

The source code of 8.0.36:
https://svn.apache.org/viewvc/tomcat/archive/tc8.0.x/tags/TOMCAT_8_0_36/java/org/apache/juli/ClassLoaderLogManager.java?revision=1848138&view=markup#l479

>474            // Try the default JVM configuration
>475                if (is == null) {
>476                    File defaultFile = new File(new 
>File(System.getProperty("java.home"), "lib"),
>477                        "logging.properties");
>478                    try {
>479                        is = new FileInputStream(defaultFile);
>480                    } catch (IOException e) {
>481                        System.err.println("Configuration error");
>482                        e.printStackTrace();
>483                    }
>484                }

The current code in main:
https://github.com/apache/tomcat/blob/main/java/org/apache/juli/ClassLoaderLogManager.java#L415

>   File defaultFile = new File(new File(System.getProperty("java.home"), 
> "conf"), "logging.properties");

The same in Tomcat 9.0.x branch:
https://github.com/apache/tomcat/blob/9.0.x/java/org/apache/juli/ClassLoaderLogManager.java#L472

>   File defaultFile = new File(new File(System.getProperty("java.home"), 
> isJava9 ? "conf" : "lib"),
>        "logging.properties");

Note the difference: the modern code looks for a file in $JAVA_HOME/conf/,
while the old one was using $JAVA_HOME/lib/, and Tomcat 9 may use either one.

This change, supporting running on Java 9+, was implemented in September 2017
by
https://github.com/apache/tomcat/commit/e9fe84b1a3432f02a86a8762a8ecfb19ac144cea

-- 
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