1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.logging.log4j.core.async;
18
19 import com.lmax.disruptor.ExceptionHandler;
20
21
22
23
24 abstract class AbstractAsyncExceptionHandler<T> implements ExceptionHandler<T> {
25
26 @Override
27 public void handleEventException(final Throwable throwable, final long sequence, final T event) {
28 try {
29
30
31
32 System.err.print("AsyncLogger error handling event seq=");
33 System.err.print(sequence);
34 System.err.print(", value='");
35 try {
36 System.err.print(event);
37 } catch (final Throwable t) {
38 System.err.print("ERROR calling toString() on ");
39 System.err.print(event.getClass().getName());
40 System.err.print(": ");
41 System.err.print(t.getClass().getName());
42 System.err.print(": ");
43 System.err.print(t.getMessage());
44 }
45 System.err.print("': ");
46 System.err.print(throwable.getClass().getName());
47 System.err.print(": ");
48 System.err.println(throwable.getMessage());
49
50
51 throwable.printStackTrace();
52 } catch (final Throwable ignored) {
53
54
55 }
56 }
57
58 @Override
59 public void handleOnStartException(final Throwable throwable) {
60 System.err.println("AsyncLogger error starting:");
61 throwable.printStackTrace();
62 }
63
64 @Override
65 public void handleOnShutdownException(final Throwable throwable) {
66 System.err.println("AsyncLogger error shutting down:");
67 throwable.printStackTrace();
68 }
69 }