16
16
*/
17
17
package org .apache .logging .log4j .core .async ;
18
18
19
- import org .apache .logging .log4j .Level ;
20
- import org .apache .logging .log4j .Marker ;
21
- import org .apache .logging .log4j .core .LogEvent ;
22
- import org .apache .logging .log4j .core .appender .AsyncAppender ;
23
- import org .apache .logging .log4j .message .Message ;
24
-
25
19
/**
26
20
* Enumeration over the different destinations where a log event can be sent.
27
21
*
@@ -35,86 +29,15 @@ public enum EventRoute {
35
29
/**
36
30
* Enqueues the event for asynchronous logging in the background thread.
37
31
*/
38
- ENQUEUE {
39
- @ Override
40
- public void logMessage (
41
- final AsyncLogger asyncLogger ,
42
- final String fqcn ,
43
- final Level level ,
44
- final Marker marker ,
45
- final Message message ,
46
- final Throwable thrown ) {}
47
-
48
- @ Override
49
- public void logMessage (final AsyncLoggerConfig asyncLoggerConfig , final LogEvent event ) {
50
- asyncLoggerConfig .logInBackgroundThread (event );
51
- }
52
-
53
- @ Override
54
- public void logMessage (final AsyncAppender asyncAppender , final LogEvent logEvent ) {
55
- asyncAppender .logMessageInBackgroundThread (logEvent );
56
- }
57
- },
32
+ ENQUEUE ,
58
33
/**
59
34
* Logs the event synchronously: sends the event directly to the appender (in the current thread).
60
35
* WARNING: This may result in lines logged out of order as synchronous events may be persisted before
61
36
* earlier events, even from the same thread, which wait in the queue.
62
37
*/
63
- SYNCHRONOUS {
64
- @ Override
65
- public void logMessage (
66
- final AsyncLogger asyncLogger ,
67
- final String fqcn ,
68
- final Level level ,
69
- final Marker marker ,
70
- final Message message ,
71
- final Throwable thrown ) {}
72
-
73
- @ Override
74
- public void logMessage (final AsyncLoggerConfig asyncLoggerConfig , final LogEvent event ) {
75
- asyncLoggerConfig .logToAsyncLoggerConfigsOnCurrentThread (event );
76
- }
77
-
78
- @ Override
79
- public void logMessage (final AsyncAppender asyncAppender , final LogEvent logEvent ) {
80
- asyncAppender .logMessageInCurrentThread (logEvent );
81
- }
82
- },
38
+ SYNCHRONOUS ,
83
39
/**
84
40
* Discards the event (so it is not logged at all).
85
41
*/
86
- DISCARD {
87
- @ Override
88
- public void logMessage (
89
- final AsyncLogger asyncLogger ,
90
- final String fqcn ,
91
- final Level level ,
92
- final Marker marker ,
93
- final Message message ,
94
- final Throwable thrown ) {
95
- // do nothing: drop the event
96
- }
97
-
98
- @ Override
99
- public void logMessage (final AsyncLoggerConfig asyncLoggerConfig , final LogEvent event ) {
100
- // do nothing: drop the event
101
- }
102
-
103
- @ Override
104
- public void logMessage (final AsyncAppender asyncAppender , final LogEvent coreEvent ) {
105
- // do nothing: drop the event
106
- }
107
- };
108
-
109
- public abstract void logMessage (
110
- final AsyncLogger asyncLogger ,
111
- final String fqcn ,
112
- final Level level ,
113
- final Marker marker ,
114
- final Message message ,
115
- final Throwable thrown );
116
-
117
- public abstract void logMessage (final AsyncLoggerConfig asyncLoggerConfig , final LogEvent event );
118
-
119
- public abstract void logMessage (final AsyncAppender asyncAppender , final LogEvent coreEvent );
42
+ DISCARD ;
120
43
}
0 commit comments