Re: Tomcat 9.0.20 : send email on errors

2019-07-22 Thread Konstantin Kolinko
пн, 22 июл. 2019 г. в 20:38, Robert Hicks :
>
> 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



Re: Tomcat 9.0.20 : send email on errors

2019-07-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Robert,

On 7/22/19 13:37, Robert Hicks wrote:
> 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?
> 
> The scenario I am thinking of would be if the logging file system
> is full or unavailable due to other issues.

I don't think JULI can email at all under its normal
deployment/configuration. You will have to add more code/libs just to
get email to work.

As for falling-back to email if "normal" logging fails? You'd probably
have to implement your own component for the logging system to do
that. (I don't know what JULI calls the components that actually e.g.
write to log files -- log4j calls them "Appenders" FWIW.)

- -chris
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl02A2kACgkQHPApP6U8
pFhyXg/9FnuyhBjtPdENW5d5QYBHGUdS1ZscyhBb//XfY/adkLkklR4pKCA0YGTj
64pCwWEwkQCCg4LHkSTNSkM5VHAc/vqTqfX9s2kiKgHdN7KWJq+Z/vxKokVVBd61
62GpQka+NRPCx+LByqLGpJ+LlsMqd+DKSsKt9e1P875c8HTMtkMwrmUphp7xsD96
vK74wUmTSypWkQIZcw5GwZnrnPL29GLy+sUx7XwkGbDZvs+Vyw9UibsVAbr1YAbw
l0qxq85BPxiqYffm50TgVhUwohrVPd8f/RLKjx5ICHdtFovC4DbpRoIQhEEbNDgR
+VYSPPQLefohe94ffedG7BmZ+HdCCD5IBpi0mUq56lRCE56XVm1+1VUv2RAOerhB
zn6xslaLt5YSIzbnRTiNLQi08odBUmxOZ+5NbG6BlaCzOkjb6/ruRAq7XB9yMElI
c+WV54DF7fiejToIIWey9Ky7/uBvFsuvj8lqxIfNT5jzvs/X+ma5wIWnKBJ2gTcV
FmqNeINUUBnT9SVNm1wKNA809bpwOglmPHOeGwvfALqW8MX7Puqj0X4wjqle4+P1
TwtMjKowt2NTmzpMO+ho2nNP3/OTF5ufP07S92OkHXujsn6K54hduQwqhwB5eCjA
k1IP2SRi91HGhc/CDk+Oq6m2rQQSVvcTggyhiog655QIy51EJF0=
=Wa6H
-END PGP SIGNATURE-

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