[Bug 69584] CATALINA_LOGGING_CONFIG is missing in stop command

2025-02-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69584

--- Comment #5 from K  ---
(In reply to Chuck Caldarale from comment #3)
> Mixing jars from different Tomcat versions (nearly 8 years apart!) is not
> supported. I'm rather surprised that Tomcat starts at all.

I am not actually mixing jars from older implementations.  I am replacing the
provided tomcat-juli implementation with a custom version that was based on an
older version of tomcat-juli.

Tomcat is designed to support replacing the tomcat JUL implementation.

To replace the tomcat logging implementation you need to apply a new logging
manager with LOGGING_MANAGER and logging config file with
CATALINA_LOGGING_CONFIG.  This is successfully done with that "start" command.

eval exec "\"$_RUNJDB\"" "\"$CATALINA_LOGGING_CONFIG\"" $LOGGING_MANAGER
"$JAVA_OPTS" "$CATALINA_OPTS" \
-classpath "$CLASSPATH" \
-sourcepath "$CATALINA_HOME"/../../java \
-Dcatalina.base="$CATALINA_BASE" \
-Dcatalina.home="$CATALINA_HOME" \
-Djava.io.tmpdir="$CATALINA_TMPDIR" \
org.apache.catalina.startup.Bootstrap "$@" start

but the "stop" command does not apply the CATALINA_LOGGING_CONFIG.

eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
-classpath "\"$CLASSPATH\"" \
-Dcatalina.base="\"$CATALINA_BASE\"" \
-Dcatalina.home="\"$CATALINA_HOME\"" \
-Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
org.apache.catalina.startup.Bootstrap "$@" stop

#   CATALINA_LOGGING_CONFIG (Optional) Override Tomcat's logging config file
#   Example (all one line)
#  
CATALINA_LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"
#
#   LOGGING_MANAGER (Optional) Override Tomcat's logging manager
#   Example (all one line)
#  
LOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"

The system properties provided in these two environment variables should always
be provided together.

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



(tomcat) branch main updated: Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" in catalina.sh commands

2025-02-15 Thread dsoumis
This is an automated email from the ASF dual-hosted git repository.

dsoumis pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 79e4d27450 Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" 
in catalina.sh commands
79e4d27450 is described below

commit 79e4d27450d67103b19e31a9040bfe5f2234e671
Author: Dimitris Soumis 
AuthorDate: Sat Feb 15 22:18:17 2025 +0200

Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" in catalina.sh 
commands

https://bz.apache.org/bugzilla/show_bug.cgi?id=69584
---
 bin/catalina.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/catalina.sh b/bin/catalina.sh
index ee679ad0c6..d8d90d0416 100755
--- a/bin/catalina.sh
+++ b/bin/catalina.sh
@@ -463,7 +463,7 @@ elif [ "$1" = "stop" ] ; then
 fi
   fi
 
-  eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
+  eval "\"$_RUNJAVA\"" "\"$CATALINA_LOGGING_CONFIG\"" $LOGGING_MANAGER 
"$JAVA_OPTS" \
 -classpath "\"$CLASSPATH\"" \
 -Dcatalina.base="\"$CATALINA_BASE\"" \
 -Dcatalina.home="\"$CATALINA_HOME\"" \
@@ -549,7 +549,7 @@ elif [ "$1" = "stop" ] ; then
 
 elif [ "$1" = "configtest" ] ; then
 
-eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
+eval "\"$_RUNJAVA\"" "\"$CATALINA_LOGGING_CONFIG\"" $LOGGING_MANAGER 
"$JAVA_OPTS" \
   -classpath "\"$CLASSPATH\"" \
   -Dcatalina.base="\"$CATALINA_BASE\"" \
   -Dcatalina.home="\"$CATALINA_HOME\"" \


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



(tomcat) branch 11.0.x updated: Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" in catalina.sh commands

2025-02-15 Thread dsoumis
This is an automated email from the ASF dual-hosted git repository.

dsoumis pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
 new 2d50aa64ea Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" 
in catalina.sh commands
2d50aa64ea is described below

commit 2d50aa64eaf0fe84272fc8556abdfa82b36dfad8
Author: Dimitris Soumis 
AuthorDate: Sat Feb 15 22:18:17 2025 +0200

Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" in catalina.sh 
commands

https://bz.apache.org/bugzilla/show_bug.cgi?id=69584
---
 bin/catalina.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/catalina.sh b/bin/catalina.sh
index c5a996cb65..4755c1576f 100755
--- a/bin/catalina.sh
+++ b/bin/catalina.sh
@@ -470,7 +470,7 @@ elif [ "$1" = "stop" ] ; then
 fi
   fi
 
-  eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
+  eval "\"$_RUNJAVA\"" "\"$CATALINA_LOGGING_CONFIG\"" $LOGGING_MANAGER 
"$JAVA_OPTS" \
 -classpath "\"$CLASSPATH\"" \
 -Dcatalina.base="\"$CATALINA_BASE\"" \
 -Dcatalina.home="\"$CATALINA_HOME\"" \
@@ -556,7 +556,7 @@ elif [ "$1" = "stop" ] ; then
 
 elif [ "$1" = "configtest" ] ; then
 
-eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
+eval "\"$_RUNJAVA\"" "\"$CATALINA_LOGGING_CONFIG\"" $LOGGING_MANAGER 
"$JAVA_OPTS" \
   -classpath "\"$CLASSPATH\"" \
   -Dcatalina.base="\"$CATALINA_BASE\"" \
   -Dcatalina.home="\"$CATALINA_HOME\"" \


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



(tomcat) branch 10.1.x updated: Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" in catalina.sh commands

2025-02-15 Thread dsoumis
This is an automated email from the ASF dual-hosted git repository.

dsoumis pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
 new a83979963a Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" 
in catalina.sh commands
a83979963a is described below

commit a83979963ad2c0f2812323610a27883176352bba
Author: Dimitris Soumis 
AuthorDate: Sat Feb 15 22:18:17 2025 +0200

Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" in catalina.sh 
commands

https://bz.apache.org/bugzilla/show_bug.cgi?id=69584
---
 bin/catalina.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/catalina.sh b/bin/catalina.sh
index 959a637389..3ae29bc8eb 100755
--- a/bin/catalina.sh
+++ b/bin/catalina.sh
@@ -521,7 +521,7 @@ elif [ "$1" = "stop" ] ; then
 fi
   fi
 
-  eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
+  eval "\"$_RUNJAVA\"" "\"$CATALINA_LOGGING_CONFIG\"" $LOGGING_MANAGER 
"$JAVA_OPTS" \
 -classpath "\"$CLASSPATH\"" \
 -Dcatalina.base="\"$CATALINA_BASE\"" \
 -Dcatalina.home="\"$CATALINA_HOME\"" \
@@ -607,7 +607,7 @@ elif [ "$1" = "stop" ] ; then
 
 elif [ "$1" = "configtest" ] ; then
 
-eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
+eval "\"$_RUNJAVA\"" "\"$CATALINA_LOGGING_CONFIG\"" $LOGGING_MANAGER 
"$JAVA_OPTS" \
   -classpath "\"$CLASSPATH\"" \
   -Dcatalina.base="\"$CATALINA_BASE\"" \
   -Dcatalina.home="\"$CATALINA_HOME\"" \


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



(tomcat) branch 9.0.x updated: Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" in catalina.sh commands

2025-02-15 Thread dsoumis
This is an automated email from the ASF dual-hosted git repository.

dsoumis pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new e9384a81ed Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" 
in catalina.sh commands
e9384a81ed is described below

commit e9384a81edec9aa5ce1d7a6a2d16198ad1b83736
Author: Dimitris Soumis 
AuthorDate: Sat Feb 15 22:18:17 2025 +0200

Fix BZ 69584 - Include missing "$CATALINA_LOGGING_CONFIG" in catalina.sh 
commands

https://bz.apache.org/bugzilla/show_bug.cgi?id=69584
---
 bin/catalina.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/catalina.sh b/bin/catalina.sh
index 8d07001214..90bd5b74d6 100755
--- a/bin/catalina.sh
+++ b/bin/catalina.sh
@@ -561,7 +561,7 @@ elif [ "$1" = "stop" ] ; then
 fi
   fi
 
-  eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
+  eval "\"$_RUNJAVA\"" "\"$CATALINA_LOGGING_CONFIG\"" $LOGGING_MANAGER 
"$JAVA_OPTS" \
 -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
 -classpath "\"$CLASSPATH\"" \
 -Dcatalina.base="\"$CATALINA_BASE\"" \
@@ -648,7 +648,7 @@ elif [ "$1" = "stop" ] ; then
 
 elif [ "$1" = "configtest" ] ; then
 
-eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
+eval "\"$_RUNJAVA\"" "\"$CATALINA_LOGGING_CONFIG\"" $LOGGING_MANAGER 
"$JAVA_OPTS" \
   -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
   -classpath "\"$CLASSPATH\"" \
   -Dcatalina.base="\"$CATALINA_BASE\"" \


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



Buildbot success in on tomcat-9.0.x

2025-02-15 Thread buildbot
Build status: Build succeeded!
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/37/builds/1274
Blamelist: Dimitris Soumis , Mark Thomas 
Build Text: build successful
Status Detected: restored build
Build Source Stamp: [branch 9.0.x] e9384a81edec9aa5ce1d7a6a2d16198ad1b83736


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  compile: 1

  shell_6: 0

  shell_7: 0

  shell_8: 0

  shell_9: 0

  Rsync docs to nightlies.apache.org: 0

  shell_10: 0

  Rsync RAT to nightlies.apache.org: 0

  compile_1: 1

  shell_11: 0

  Rsync Logs to nightlies.apache.org: 0


-- ASF Buildbot


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



Re: [PR] Refactor CSRF Filter: Simplify Logic, Improve Logging, and Enhance Code Readability [tomcat]

2025-02-15 Thread via GitHub


dsoumis commented on PR #827:
URL: https://github.com/apache/tomcat/pull/827#issuecomment-2661100096

   1) I am not in favor of the helper class. Conditions like if 
(log.isDebugEnabled()) and if (log.isTraceEnabled()) are widely used in the 
code and I believe it makes it more transparent when the logging occurs.
   
   2) Since early returns (guard clauses) are not applied to all conditions, 
removing the else blocks makes the code harder to analyze.
   
   3) The filter is being invoked twice


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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



[Bug 69584] CATALINA_LOGGING_CONFIG is missing in stop command

2025-02-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69584

Konstantin Kolinko  changed:

   What|Removed |Added

 Resolution|FIXED   |---
 Status|RESOLVED|REOPENED

--- Comment #6 from Konstantin Kolinko  ---
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.(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
>475if (is == null) {
>476File defaultFile = new File(new 
>File(System.getProperty("java.home"), "lib"),
>477"logging.properties");
>478try {
>479is = new FileInputStream(defaultFile);
>480} catch (IOException e) {
>481System.err.println("Configuration error");
>482e.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



Re: [PR] Refactor CSRF Filter: Simplify Logic, Improve Logging, and Enhance Code Readability [tomcat]

2025-02-15 Thread via GitHub


koust6u closed pull request #827: Refactor CSRF Filter: Simplify Logic, Improve 
Logging, and Enhance Code Readability
URL: https://github.com/apache/tomcat/pull/827


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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



[Bug 69584] CATALINA_LOGGING_CONFIG is missing in stop command

2025-02-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69584

--- Comment #7 from Chuck Caldarale  ---
I strongly agree with Konstantin - the "stop" process must not be using the
same logging configuration as the Tomcat server.

Note that when the old 8.0.36 version of tomcat-juli.jar is substituted for the
current 10.1.34 one, the "stop" operation still succeeds; the exception report
is simply cosmetic, indicating that there is a non-fatal problem with the
modified jar.

There have been many changes to the tomcat-juli package over the past 8 years;
the OP should be keeping his modified version up to date with the changes to
insure compatibility with both Tomcat and Java (eg, the forthcoming removal of
security manager).

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



Re: [PR] Refactor CSRF Filter: Simplify Logic, Improve Logging, and Enhance Code Readability [tomcat]

2025-02-15 Thread via GitHub


koust6u commented on PR #827:
URL: https://github.com/apache/tomcat/pull/827#issuecomment-2661166088

   Thank you for the thorough review and detailed feedback. I now understand 
your concerns regarding the logging helper and the importance of explicitly 
showing when logging occurs. Your point about the removal of else blocks making 
the code harder to analyze also makes sense, especially given that early 
returns were not applied consistently. Additionally, I see the issue with the 
filter being invoked twice.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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



[PR] Add unit tests for AsyncStateMachine's asyncPostProcess method [tomcat]

2025-02-15 Thread via GitHub


koust6u opened a new pull request, #828:
URL: https://github.com/apache/tomcat/pull/828

   + Added unit tests for various asyncPostProcess state transitions.
   + Replaced dependencies with fake objects for isolated testing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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



[Bug 69584] CATALINA_LOGGING_CONFIG is missing in stop command

2025-02-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69584

Chuck Caldarale  changed:

   What|Removed |Added

 Status|NEEDINFO|RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from Chuck Caldarale  ---
Mixing jars from different Tomcat versions (nearly 8 years apart!) is not
supported. I'm rather surprised that Tomcat starts at all.

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



[Bug 69584] CATALINA_LOGGING_CONFIG is missing in stop command

2025-02-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69584

K  changed:

   What|Removed |Added

 Resolution|INVALID |FIXED

--- Comment #4 from K  ---
tomcat-juli implements the java.util.logging interface that tomcat core uses so
it should and does function with different version.

If I implemented a custom version of java.util.logging this would still be an
issue.  The catalina.sh stop command is applying system properties to
initialize the implementation of java.util.logging with LOGGING_MANAGER but not
the logging configuration CATALINA_LOGGING_CONFIG.

I can make a work-around for this by initializing LOGGING_MANAGER, in
setenv.sh, with both system properties for java.util.logging.manager and
java.util.logging.config.file though this seems like an over-site to initialize
the java.util.logging log manager without the configuration.

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



[Bug 69584] CATALINA_LOGGING_CONFIG is missing in stop command

2025-02-15 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69584

--- Comment #2 from K  ---
1)  Using the default system properties applied by catalina.sh for tomcat-juli.

CATALINA_LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"

2) Only notable change is that I am using an older version of tomcat-juli. 
8.0.36

3) Running on linux OS and jdk 17.0.14+7


Main issue is that for the stop command catalina.sh is setting up the
tomcat-juli log manager
(-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager) but
excluding the tomcat-juli configuration
(-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties)

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