2
2
3
3
import org .slf4j .Logger ;
4
4
import org .slf4j .LoggerFactory ;
5
+ import org .slf4j .MDC ;
5
6
6
7
import java .io .FileNotFoundException ;
7
8
import java .io .Reader ;
28
29
import dmg .util .Slf4jErrorWriter ;
29
30
import dmg .util .Slf4jInfoWriter ;
30
31
import dmg .util .logback .FilterThresholds ;
32
+ import dmg .util .logback .RootFilterThresholds ;
31
33
32
34
/**
33
35
*
@@ -130,6 +132,16 @@ public CellNucleus(Cell cell, String name, String type)
130
132
_cell = cell ;
131
133
_cellClass = _cell .getClass ().getName ();
132
134
135
+ /* Instantiate management component for log filtering.
136
+ */
137
+ CellNucleus parentNucleus =
138
+ CellNucleus .getLogTargetForCell (MDC .get (CDC .MDC_CELL ));
139
+ FilterThresholds parentThresholds =
140
+ (parentNucleus .isSystemNucleus () || parentNucleus == this )
141
+ ? RootFilterThresholds .getInstance ()
142
+ : parentNucleus .getLoggingThresholds ();
143
+ setLoggingThresholds (new FilterThresholds (parentThresholds ));
144
+
133
145
//
134
146
// for the use in restricted sandboxes
135
147
//
@@ -153,7 +165,7 @@ public CellNucleus(Cell cell, String name, String type)
153
165
_printoutLevel = __cellGlue .getDefaultPrintoutLevel ();
154
166
__cellGlue .addCell (_cellName , this );
155
167
156
- _logNucleus .info ("Created : " + name );
168
+ _logNucleus .info ("Created : " + name );
157
169
}
158
170
159
171
/**
@@ -649,7 +661,8 @@ private void killThreads(Collection<Thread> threads)
649
661
{
650
662
for (Thread thread : threads ) {
651
663
if (thread .isAlive ()) {
652
- _logNucleus .info ("killerThread : interrupting " + thread .getName ());
664
+ _logNucleus .info ("killerThread : interrupting " + thread
665
+ .getName ());
653
666
thread .interrupt ();
654
667
}
655
668
}
@@ -745,7 +758,7 @@ void addToEventQueue(MessageEvent ce) {
745
758
//
746
759
final CellMessage msg = ce .getMessage ();
747
760
if (msg != null ) {
748
- _logNucleus .info ("addToEventQueue : message arrived : " + msg );
761
+ _logNucleus .info ("addToEventQueue : message arrived : " + msg );
749
762
CellLock lock ;
750
763
751
764
synchronized (_waitHash ) {
@@ -756,16 +769,16 @@ void addToEventQueue(MessageEvent ce) {
756
769
//
757
770
// we were waiting for you (sync or async)
758
771
//
759
- _logNucleus .info ("addToEventQueue : lock found for : " + msg );
772
+ _logNucleus .info ("addToEventQueue : lock found for : " + msg );
760
773
if (lock .isSync ()) {
761
- _logNucleus .info ("addToEventQueue : is synchronous : " + msg );
774
+ _logNucleus .info ("addToEventQueue : is synchronous : " + msg );
762
775
synchronized (lock ) {
763
776
lock .setObject (msg );
764
777
lock .notifyAll ();
765
778
}
766
- _logNucleus .info ("addToEventQueue : dest. was triggered : " + msg );
779
+ _logNucleus .info ("addToEventQueue : dest. was triggered : " + msg );
767
780
} else {
768
- _logNucleus .info ("addToEventQueue : is asynchronous : " + msg );
781
+ _logNucleus .info ("addToEventQueue : is asynchronous : " + msg );
769
782
try {
770
783
_callbackExecutor .execute (new CallbackTask (lock , msg ));
771
784
} catch (RejectedExecutionException e ) {
@@ -794,7 +807,7 @@ void sendKillEvent(KillEvent ce)
794
807
Thread thread = new Thread (__cellGlue .getKillerThreadGroup (), wrapLoggingContext (new KillerTask (ce )), "killer-" + _cellName );
795
808
thread .start ();
796
809
_logNucleus .info ("sendKillEvent : {} started on group {}" ,
797
- thread .getName (), thread .getThreadGroup ().getName ());
810
+ thread .getName (), thread .getThreadGroup ().getName ());
798
811
}
799
812
800
813
//
@@ -962,7 +975,7 @@ public void run()
962
975
shutdownPrivateExecutors ();
963
976
964
977
_logNucleus .info ("killerThread : waiting for all threads in {} to finish" ,
965
- _threads );
978
+ _threads );
966
979
967
980
try {
968
981
Collection <Thread > threads = getNonDaemonThreads (_threads );
@@ -1089,15 +1102,18 @@ public void innerRun()
1089
1102
//
1090
1103
if (_logMessages .isDebugEnabled ()) {
1091
1104
String messageObject = msg .getMessageObject () == null ? "NULL" : msg .getMessageObject ().getClass ().getName ();
1092
- _logMessages .debug ("nucleusMessageArrived src=" + msg .getSourcePath () +
1093
- " dest=" + msg .getDestinationPath () + " [" + messageObject + "] UOID=" + msg .getUOID ().toString ());
1105
+ _logMessages .debug ("nucleusMessageArrived src=" + msg
1106
+ .getSourcePath () +
1107
+ " dest=" + msg
1108
+ .getDestinationPath () + " [" + messageObject + "] UOID=" + msg
1109
+ .getUOID ().toString ());
1094
1110
}
1095
1111
//
1096
1112
// and deliver it
1097
1113
//
1098
- _logNucleus .info ("messageThread : delivering message : " + msg );
1114
+ _logNucleus .info ("messageThread : delivering message : " + msg );
1099
1115
_cell .messageArrived (new MessageEvent (msg ));
1100
- _logNucleus .info ("messageThread : delivering message done : " + msg );
1116
+ _logNucleus .info ("messageThread : delivering message done : " + msg );
1101
1117
} catch (RuntimeException e ) {
1102
1118
if (!msg .isReply ()) {
1103
1119
try {
0 commit comments