Methods Summary |
---|
private void | addListener(com.sun.enterprise.management.ext.logging.LogMBeanIntf logMBean)
final MyLogMBeanListener listener = new MyLogMBeanListener();
final NotificationFilter filter = null;
logMBean.addNotificationListener( listener, filter, null );
|
private com.sun.appserv.management.ext.logging.LogQueryResult | convertQueryResult(javax.management.AttributeList queryResult)
// extract field descriptions into a String[]
final AttributeList fieldAttrs = (AttributeList)((Attribute)queryResult.get( 0 )).getValue();
final String[] fieldHeaders = new String[ fieldAttrs.size() ];
assert( fieldHeaders.length == LogRecordFields.NUM_FIELDS );
for( int i = 0; i < fieldHeaders.length; ++i )
{
final Attribute attr = (Attribute)fieldAttrs.get( i );
fieldHeaders[ i ] = (String)attr.getValue();
//System.out.println( fieldHeaders[ i ] );
}
// extract every record
final List<List<Serializable>> records =
TypeCast.asList( ((Attribute)queryResult.get( 1 )).getValue() );
final LogQueryEntry[] entries = new LogQueryEntry[ records.size() ];
for( int recordIdx = 0; recordIdx < records.size(); ++recordIdx )
{
final List<Serializable> record = records.get( recordIdx );
TypeCast.checkList( record, Serializable.class );
assert( record.size() == fieldHeaders.length );
final Serializable[] fieldValues = new Serializable[ fieldHeaders.length ];
for( int fieldIdx = 0; fieldIdx < fieldValues.length; ++fieldIdx )
{
fieldValues[ fieldIdx ] = record.get( fieldIdx );
}
entries[ recordIdx ] = new LogQueryEntryImpl( fieldValues );
}
return new LogQueryResultImpl( fieldHeaders, entries );
|
private void | displayAttribute(javax.management.Attribute attr)
trace( "Attribute: " + attr.getName() );
final Object value = attr.getValue();
trace( " Value: " + (value == null ? "null" : value.getClass().getName()) );
|
public static com.sun.enterprise.management.Capabilities | getCapabilities()
return getOfflineCapableCapabilities( false );
|
public com.sun.enterprise.management.ext.logging.LogMBeanIntf | getLogMBean()
return mLogMBean;
|
public com.sun.enterprise.management.ext.logging.LogMBeanIntf | initLogMBean()
final LogMBeanIntf logMBean = (LogMBeanIntf)
MBeanServerInvocationHandler.newProxyInstance(
getConnection(), mTarget, LogMBeanIntf.class, true );
return logMBean;
|
public void | testGetArchivedLogFiles()
final String[] names = getLogMBean().getArchivedLogfiles();
//trace( "getArchivedLogFiles: " + ArrayStringifier.stringify( names, "\n") );
|
public void | testGetLogFilesDirectory()
final String name = getLogMBean().getLogFilesDirectory();
//trace( "getLogFilesDirectory: " + name );
|
public void | testGetLoggerNames()
final List<String> names = TypeCast.asList( getLogMBean().getLoggerNames() );
TypeCast.checkList( names, String.class );
//System.out.println( "getLogFilesDirectory: " + names );
for( final String name : names )
{
final String level = getLogMBean().getLogLevel( name );
Level.parse( level );
final List<String> unders = TypeCast.asList( getLogMBean().getLoggerNamesUnder( name ) );
TypeCast.checkList( unders, String.class );
}
|
public void | testQuery()
final String filename = "server.log";
final Boolean searchForward = Boolean.TRUE;
final Boolean sortAscending = Boolean.TRUE;
final int startRecord = 0;
final int requestedCount = 1000 * 1000;
final Date fromDate = null;
final Date toDate = null;
final List<Object> listOfModules = null;
final Boolean levelOnly = Boolean.FALSE;
final Properties props = null;
final AttributeList attrs = getLogMBean().getLogRecordsUsingQuery(
filename,
new Long( startRecord ),
searchForward,
sortAscending,
new Integer( requestedCount ),
fromDate,
toDate,
Level.WARNING.toString(),
levelOnly,
listOfModules,
props );
final LogQueryResult result = convertQueryResult( attrs );
final LogQueryEntry[] entries = result.getEntries();
assert( entries.length != 0 );
for( final LogQueryEntry entry : entries )
{
final String messageID = entry.getMessageID();
final ArrayList causes = getLogMBean().getDiagnosticCausesForMessageId( messageID );
//trace( causes );
final ArrayList checks = getLogMBean().getDiagnosticChecksForMessageId( messageID );
//trace( checks );
final String uri = getLogMBean().getDiagnosticURIForMessageId( messageID );
//trace( uri );
}
// trace( result );
|