пн, 22 июл. 2019 г. в 20:38, Robert Hicks <robert.hi...@gmail.com>:
>
> Using the default logging (java.util.logging) is it possible to have Tomcat
> itself (not a jsp or servlet) send an email if it is unable to log or there
> are errors in its log files?

This question reminds me of Zawinski's Law.

Reliable monitoring would better be performed by some external tool.

> The scenario I am thinking of would be if the logging file system is full
> or unavailable due to other issues.

java.util.logging has an internal mechanism to handle fatal errors.

To reference some source code - looking at some version of JDK 8, see
the files in
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/util/logging

For example, see how StreamHandler.publish() handles errors (lines of
225-228 of StreamHandler.java). If it is unable to write a message it
does

[[[
} catch (Exception ex) {
 reportError(null, ex, ErrorManager.WRITE_FAILURE);
}
]]]

The actual processing of the error is delegated to a
java.util.logging.ErrorManager.  The default implementation just
prints to System.err once and ignores further errors, but I think it
is configurable.

I hope this helps.

Best regards,
Konstantin Kolinko

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

Reply via email to