FileDocCategorySizeDatePackage
LoggingHelper.javaAPI DocGlassfish v2 API8290Fri May 04 22:30:50 BST 2007com.sun.appserv.management.helper

LoggingHelper

public final class LoggingHelper extends Helper
Helper class for simplifying access to logging.
since
AppServer 9.0

Fields Summary
private final com.sun.appserv.management.ext.logging.Logging
mLogging
Constructors Summary
public LoggingHelper(com.sun.appserv.management.ext.logging.Logging logging)
Create with default parameters.

		super( logging.getDomainRoot() );
		mLogging    = logging;
	
Methods Summary
public com.sun.appserv.management.ext.logging.LogginggetLogging()

	    return mLogging;
	
private longnow()

        return System.currentTimeMillis();
    
public com.sun.appserv.management.ext.logging.LogQueryResult[]queryAll()
Get all available log records in all files for all modules of all available log levels.

see
LogQuery

	    final String[]  names    = getLogging().getLogFileNames( SERVER_KEY );
	    
	    final List<LogQueryResult>  all = new ArrayList<LogQueryResult>( names.length );
	    for( final String name : names )
	    {
	        // a log file could disappear while querying
	        try
	        {
	            final LogQueryResult result   = queryAllInFile( name );
	            all.add( result );
	        }
	        catch( Exception e )
	        {
	            // ignore and try next one.
	        }
	    }
	    
	    final LogQueryResult[]  results = new LogQueryResultImpl[ all.size() ];
	    return all.toArray( results );
	
public com.sun.appserv.management.ext.logging.LogQueryResultqueryAllCurrent()
Get all available log records for all modules in the most current log file.

see
LogQuery

        return queryAllInFile( MOST_RECENT_NAME );
    
public com.sun.appserv.management.ext.logging.LogQueryResultqueryAllInFile(java.lang.String name)
Get all available log records for all modules in the specified log file.

see
LogQuery

        final int       startIndex      = FIRST_RECORD;
        final boolean   searchForward   = true;
        final int       maxRecords      = ALL_RECORDS;
        final Long      startTime       = null;
        final Long      stopTime        = null;
        final List<Attribute>  attrs    = null;
        
        final LogQueryResult result = getLogging().queryServerLog(
            name,
            startIndex,
            searchForward,
            maxRecords,
            startTime,
            stopTime,
            LOWEST_SUPPORTED_QUERY_LEVEL,
            LogModuleNames.ALL_NAMES,
            attrs );
        
        return result;
    
public com.sun.appserv.management.ext.logging.LogQueryResultqueryServerLog(java.lang.String logLevel, java.util.Set modules)
Get all log records of the specified error level or higher level for a all specified modules in the most current log file.

see
LogQuery
see
LogModuleNames

        final String    name            = MOST_RECENT_NAME;
        final int       startIndex      = FIRST_RECORD;
        final boolean   searchForward   = true;
        final int       maxRecords      = ALL_RECORDS;
        final Long      startTime       = null;
        final Long      stopTime        = null;
        final List<Attribute>  attrs    = null;
        
        assert( getLogging() != null );
        
        final LogQueryResult result = getLogging().queryServerLog(
            name,
            startIndex,
            searchForward,
            maxRecords,
            startTime,
            stopTime,
            logLevel,
            modules,
            attrs );
        
        return result;
    
public com.sun.appserv.management.ext.logging.LogQueryResultqueryServerLog(java.lang.String logLevel, java.lang.String moduleID)
Get all log records of the specified error level or higher level for a particular module in the most current log file.

see
LogQuery

        return queryServerLog( logLevel, GSetUtil.newSet( moduleID ) );
    
public com.sun.appserv.management.ext.logging.LogQueryResultqueryServerLog(java.lang.String logLevel)
Get all log records of the specified error level or higher level for all modules in the most current log file.

see
LogQuery

        return queryServerLog( logLevel, LogModuleNames.ALL_NAMES );
    
public com.sun.appserv.management.ext.logging.LogQueryResultqueryServerLogRecent(long seconds)
Get all available log records for all modules in the most current log file which have occurred within the last number of seconds.

param
seconds
see
LogQuery

        return queryServerLogRecent( seconds, LogModuleNames.ALL_NAMES );
    
public com.sun.appserv.management.ext.logging.LogQueryResultqueryServerLogRecent(long seconds, java.util.Set modules)
Get all available log records for all modules in the most current log file which have occurred within the last number of seconds.

param
seconds
see
LogQuery

        final String    name            = MOST_RECENT_NAME;
        final int       startIndex      = LAST_RECORD;
        final boolean   searchForward   = false;
        final int       maxRecords      = ALL_RECORDS;
        final Long      startTime       = now();
        final Long      stopTime        = now() - (seconds * 1000);
        final List<Attribute>  attrs    = null;
        
        final LogQueryResult result = getLogging().queryServerLog(
            name,
            startIndex,
            searchForward,
            maxRecords,
            startTime,
            stopTime,
            LOWEST_SUPPORTED_QUERY_LEVEL,
            modules,
            attrs );
        return result;