@@ -62,34 +62,36 @@ public static long getNewTaskId() {
6262 }
6363
6464 public static synchronized void initAndGetConnectProxy () throws JCException , IOException {
65+ log .debug ("Invoking initAndGetConnectProxy" );
6566 if (knetConnectProxy == null ) {
66- log .info ("Initialize KNetConnectProxy" );
67- if (!JCOBridge .isCLRHostingProcess ()) {
68- log .info ("Initializing of KNetConnectProxy starting from JVM" );
69- }
70-
67+ log .info ("Initializing KNetConnectProxy from {}" , JCOBridge .isCLRHostingProcess () ? "CLR" : "JVM" );
7168 // initialize JCOBridge
7269 log .info ("Initializing JCOBridge" );
7370 JCOBridge .Initialize ();
7471 log .info ("Initialized JCOBridge" );
7572
7673 // get proxy
7774 if (JCOBridge .isCLRHostingProcess ()) {
75+ log .info ("Requesting allocated KNetConnectProxy from CLR" );
7876 knetConnectProxy = (JCObject ) JCOBridge .GetCLRGlobal ("KNetConnectProxy" );
79- log .info ("Recoved KNetConnectProxy from CLR" );
77+ log .info ("Recovered KNetConnectProxy from CLR" );
8078 } else {
79+ log .info ("Creating JCOBRidge instance" );
8180 bridgeInstance = JCOBridge .CreateNew ();
81+ log .info ("Allocating KNetConnectProxy instance in CLR" );
8282 knetConnectProxy = (JCObject ) bridgeInstance .NewObject ("MASES.KNet.Connect.KNetConnectProxy, MASES.KNet" );
83- log .info ("Created KNetConnectProxy in the CLR" );
84- localKNetConnectProxy = new KNetConnectProxy ();
85- bridgeInstance .RegisterEventLog (localKNetConnectProxy );
83+ log .info ("Allocated KNetConnectProxy in the CLR" );
84+ if (null != System .getenv ("KNetConnectEnableJCOBridgeLogging" )) {
85+ log .info ("Enabling advance logging from JCOBridge" );
86+ localKNetConnectProxy = new KNetConnectProxy ();
87+ bridgeInstance .RegisterEventLog (localKNetConnectProxy );
88+ }
8689 }
8790 }
88- log .debug ("Returning KNetConnectProxy instance" );
8991 }
9092
9193 public static synchronized boolean initializeSinkConnector (KNetConnectInitializer sink , Map <String , String > props ) throws JCException , IOException {
92- log .info ("Invoking initializeSinkConnector" );
94+ log .debug ("Invoking initializeSinkConnector" );
9395
9496 if (knetConnectProxy == null )
9597 throw new ConnectException ("Missing initialization of infrastructure using initAndGetConnectProxy" );
@@ -106,13 +108,13 @@ public static synchronized boolean initializeSinkConnector(KNetConnectInitialize
106108 if (className == null )
107109 throw new ConfigException (String .format ("'%s' in KNetSinkConnector configuration requires a definition" , DOTNET_CLASSNAME_CONFIG ));
108110
109- log .info ("Trying to allocate Sink Connector with class name %s " , className );
111+ log .info ("Trying to allocate Sink Connector with class name {} " , className );
110112
111113 return (boolean ) knetConnectProxy .Invoke ("AllocateSinkConnector" , className );
112114 }
113115
114116 public static synchronized boolean initializeSourceConnector (KNetConnectInitializer source , Map <String , String > props ) throws JCException , IOException {
115- log .info ("Invoking initializeSourceConnector" );
117+ log .debug ("Invoking initializeSourceConnector" );
116118
117119 if (knetConnectProxy == null )
118120 throw new ConnectException ("Missing initialization of infrastructure using initAndGetConnectProxy" );
@@ -129,13 +131,13 @@ public static synchronized boolean initializeSourceConnector(KNetConnectInitiali
129131 if (className == null )
130132 throw new ConfigException (String .format ("'%s' in KNetSourceConnector configuration requires a definition" , DOTNET_CLASSNAME_CONFIG ));
131133
132- log .info ("Trying to allocate Source Connector with class name %s " , className );
134+ log .info ("Trying to allocate Source Connector with class name {} " , className );
133135
134136 return (boolean ) knetConnectProxy .Invoke ("AllocateSourceConnector" , className );
135137 }
136138
137139 public static synchronized boolean initializeConnector (KNetConnectInitializer connector , Map <String , String > props , String uniqueId ) throws JCException , IOException {
138- log .info ("Invoking initializeConnector" );
140+ log .debug ("Invoking initializeConnector" );
139141
140142 if (knetConnectProxy == null )
141143 throw new ConnectException ("Missing initialization of infrastructure using initAndGetConnectProxy" );
@@ -165,13 +167,13 @@ public static synchronized boolean initializeConnector(KNetConnectInitializer co
165167 if (className == null )
166168 throw new ConfigException (String .format ("'%s' in connector configuration requires a definition" , DOTNET_CLASSNAME_CONFIG ));
167169
168- log .info ("Trying to allocate Connector with class name %s " , className );
170+ log .info ("Trying to allocate Connector with class name {} " , className );
169171
170172 return (boolean ) knetConnectProxy .Invoke ("AllocateConnector" , className , uniqueId );
171173 }
172174
173175 public static synchronized boolean initializeTransformation (KNetConnectInitializer connector , Map <String , ?> props , String uniqueId ) throws JCException , IOException {
174- log .info ("Invoking initializeTransform" );
176+ log .debug ("Invoking initializeTransform" );
175177
176178 if (knetConnectProxy == null )
177179 throw new ConnectException ("Missing initialization of infrastructure using initAndGetConnectProxy" );
@@ -201,13 +203,13 @@ public static synchronized boolean initializeTransformation(KNetConnectInitializ
201203 if (className == null )
202204 throw new ConfigException (String .format ("'%s' in transform configuration requires a definition" , DOTNET_CLASSNAME_CONFIG ));
203205
204- log .info ("Trying to allocate Transform with class name %s " , className );
206+ log .info ("Trying to allocate Transform with class name {} " , className );
205207
206208 return (boolean ) knetConnectProxy .Invoke ("AllocateTransformation" , className , uniqueId );
207209 }
208210
209211 public static synchronized boolean initializePredicate (KNetConnectInitializer connector , Map <String , ?> props , String uniqueId ) throws JCException , IOException {
210- log .info ("Invoking initializePredicate" );
212+ log .debug ("Invoking initializePredicate" );
211213
212214 if (knetConnectProxy == null )
213215 throw new ConnectException ("Missing initialization of infrastructure using initAndGetConnectProxy" );
@@ -237,59 +239,59 @@ public static synchronized boolean initializePredicate(KNetConnectInitializer co
237239 if (className == null )
238240 throw new ConfigException (String .format ("'%s' in predicate configuration requires a definition" , DOTNET_CLASSNAME_CONFIG ));
239241
240- log .info ("Trying to allocate Predicate with class name %s " , className );
242+ log .info ("Trying to allocate Predicate with class name {} " , className );
241243
242244 return (boolean ) knetConnectProxy .Invoke ("AllocatePredicate" , className , uniqueId );
243245 }
244246
245247 public static synchronized JCObject getSinkConnector () throws JCException , IOException {
246- log .info ("Invoking getSinkConnector" );
248+ log .debug ("Invoking getSinkConnector" );
247249
248250 if (knetConnectProxy == null )
249251 throw new ConnectException ("Missing initialization of infrastructure using initAndGetConnectProxy" );
250252
251253 if (sinkConnector == null ) {
252254 log .info ("Trying to recover name of Sink Connector" );
253255 sinkConnectorName = (String ) knetConnectProxy .Invoke ("SinkConnectorName" );
254- log .info ("Trying to recover Sink Connector with name %s " , sinkConnectorName );
256+ log .info ("Trying to recover Sink Connector with name {} " , sinkConnectorName );
255257 if (sinkConnectorName != null ) {
256258 sinkConnector = (JCObject ) JCOBridge .GetCLRGlobal (sinkConnectorName );
257- log .info ("Recovered Sink Connector with name %s " , sinkConnectorName );
259+ log .info ("Recovered Sink Connector with name {} " , sinkConnectorName );
258260 }
259261 }
260262 return sinkConnector ;
261263 }
262264
263265 public static synchronized JCObject getSourceConnector () throws JCException , IOException {
264- log .info ("Invoking getSourceConnector" );
266+ log .debug ("Invoking getSourceConnector" );
265267
266268 if (knetConnectProxy == null )
267269 throw new ConnectException ("Missing initialization of infrastructure using initAndGetConnectProxy" );
268270
269271 if (sourceConnector == null ) {
270272 log .info ("Trying to recover name of Source Connector" );
271273 sourceConnectorName = (String ) knetConnectProxy .Invoke ("SourceConnectorName" );
272- log .info ("Trying to recover Source Connector with name %s " , sourceConnectorName );
274+ log .info ("Trying to recover Source Connector with name {} " , sourceConnectorName );
273275 if (sourceConnectorName != null ) {
274276 sourceConnector = (JCObject ) JCOBridge .GetCLRGlobal (sourceConnectorName );
275- log .info ("Recovered Source Connector with name %s " , sinkConnectorName );
277+ log .info ("Recovered Source Connector with name {} " , sinkConnectorName );
276278 }
277279 }
278280 return sourceConnector ;
279281 }
280282
281283 public static synchronized JCObject getConnector (String uniqueId ) throws JCException , IOException {
282- log .info ("Invoking getConnector with id %s " , uniqueId );
284+ log .debug ("Invoking getConnector with id {} " , uniqueId );
283285 return (JCObject ) JCOBridge .GetCLRGlobal (uniqueId );
284286 }
285287
286288 public static synchronized JCObject getTransform (String uniqueId ) throws JCException , IOException {
287- log .info ("Invoking getTransform with id %s " , uniqueId );
289+ log .debug ("Invoking getTransform with id {} " , uniqueId );
288290 return (JCObject ) JCOBridge .GetCLRGlobal (uniqueId );
289291 }
290292
291293 public static synchronized JCObject getPredicate (String uniqueId ) throws JCException , IOException {
292- log .info ("Invoking getPredicate with id %s " , uniqueId );
294+ log .debug ("Invoking getPredicate with id {} " , uniqueId );
293295 return (JCObject ) JCOBridge .GetCLRGlobal (uniqueId );
294296 }
295297
@@ -311,21 +313,27 @@ public void EventLog(String var1) {
311313 debug (var1 );
312314 }
313315
316+ @ Override
317+ public String getName () { return log .getName (); }
318+
314319 @ Override
315320 public boolean isTraceEnabled () {
316321 return log .isTraceEnabled ();
317322 }
318323
319324 @ Override
320- public void trace (String var1 ) {
321- log .trace (var1 );
322- }
325+ public void trace (String var1 ) { log .trace (var1 ); }
323326
324327 @ Override
325328 public void trace (String var1 , Throwable var2 ) {
326329 log .trace (var1 , var2 );
327330 }
328331
332+ @ Override
333+ public void trace (String var1 , Object ... var2 ) {
334+ log .trace (var1 , var2 );
335+ }
336+
329337 @ Override
330338 public boolean isDebugEnabled () {
331339 return log .isDebugEnabled ();
@@ -341,6 +349,11 @@ public void debug(String var1, Throwable var2) {
341349 log .debug (var1 , var2 );
342350 }
343351
352+ @ Override
353+ public void debug (String var1 , Object ... var2 ) {
354+ log .trace (var1 , var2 );
355+ }
356+
344357 @ Override
345358 public boolean isInfoEnabled () {
346359 return log .isInfoEnabled ();
@@ -356,6 +369,11 @@ public void info(String var1, Throwable var2) {
356369 log .info (var1 , var2 );
357370 }
358371
372+ @ Override
373+ public void info (String var1 , Object ... var2 ) {
374+ log .trace (var1 , var2 );
375+ }
376+
359377 @ Override
360378 public boolean isWarnEnabled () {
361379 return log .isWarnEnabled ();
@@ -371,6 +389,9 @@ public void warn(String var1, Throwable var2) {
371389 log .warn (var1 , var2 );
372390 }
373391
392+ @ Override
393+ public void warn (String var1 , Object ... var2 ) { log .trace (var1 , var2 ); }
394+
374395 @ Override
375396 public boolean isErrorEnabled () {
376397 return log .isErrorEnabled ();
@@ -385,4 +406,9 @@ public void error(String var1) {
385406 public void error (String var1 , Throwable var2 ) {
386407 log .error (var1 , var2 );
387408 }
409+
410+ @ Override
411+ public void error (String var1 , Object ... var2 ) {
412+ log .trace (var1 , var2 );
413+ }
388414}
0 commit comments