public static Logger getLogger ( String className , String groupName ) { Logger logger = Logger . getLogger ( className ) ; if ( ! svCheckedForWAS ) { try { Class loggerHelperClass = Class . forName ( "com.ibm.ws.logging.LoggerHelper" ) ; svAddLoggerToGroupMethod = loggerHelperClass . getMethod ( "addLoggerToGroup" , new Class [ ] { Logger . class , String . class } ) ; } catch ( Exception ex ) { svLogger . logp ( Level . FINE , CLASS_NAME , "getLogger" , "failed to find addLoggerToGroup method" , ex ) ; } svCheckedForWAS = true ; } if ( svAddLoggerToGroupMethod != null ) { try { svAddLoggerToGroupMethod . invoke ( null , new Object [ ] { logger , groupName } ) ; } catch ( IllegalAccessException ex ) { svLogger . logp ( Level . FINE , CLASS_NAME , "getLogger" , "addLoggerToGroup failed" , ex ) ; } catch ( InvocationTargetException ex ) { svLogger . logp ( Level . FINE , CLASS_NAME , "getLogger" , "addLoggerToGroup failed" , ex ) ; } } return logger ; }
Gets a new logger and registers it with the specified Tr logging group .