本文整理了Java中org.apache.log.Logger.setLogTargets()
方法的一些代码示例,展示了Logger.setLogTargets()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.setLogTargets()
方法的具体详情如下:
包路径:org.apache.log.Logger
类名称:Logger
方法名:setLogTargets
[英]Set the log targets for this logger.
[中]设置此记录器的日志目标。
代码示例来源:origin: org.apache.avalon.logkit/avalon-logkit
/**
* Set the default log target for hierarchy.
* This is the target inherited by loggers if no other target is specified.
*
* @param target the default target
*/
public void setDefaultLogTarget( final LogTarget target )
{
if( null == target )
{
throw new IllegalArgumentException( "Can not set DefaultLogTarget to null" );
}
final LogTarget[] targets = new LogTarget[]{target};
getRootLogger().setLogTargets( targets );
}
代码示例来源:origin: org.apache.avalon.logkit/avalon-logkit
/**
* Set the default log targets for this hierarchy.
* These are the targets inherited by loggers if no other targets are specified
*
* @param targets the default targets
*/
public void setDefaultLogTargets( final LogTarget[] targets )
{
if( null == targets || 0 == targets.length )
{
throw new IllegalArgumentException( "Can not set DefaultLogTargets to null" );
}
for( int i = 0; i < targets.length; i++ )
{
if( null == targets[ i ] )
{
final String message = "Can not set DefaultLogTarget element to null";
throw new IllegalArgumentException( message );
}
}
getRootLogger().setLogTargets( targets );
}
代码示例来源:origin: velocity/velocity-dep
/**
* initializes the log system using the logfile argument
*
* @param logFile file for log messages
*/
public void init(String logFile)
throws Exception
{
/*
* make our FileTarget. Note we are going to keep the
* default behavior of not appending...
*/
FileTarget target = new FileTarget( new File( logFile),
false,
new VelocityFormatter("%{time} %{message}\\n%{throwable}" ) );
/*
* use the toString() of RuntimeServices to make a unique logger
*/
logger = Hierarchy.getDefaultHierarchy().getLoggerFor( rsvc.toString() );
logger.setPriority( Priority.DEBUG );
logger.setLogTargets( new LogTarget[] { target } );
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.velocity
private void initTarget(final String file, final RuntimeServices rsvc) throws Exception
{
try
{
String format = null;
Priority level = null;
if (rsvc != null)
{
format = rsvc.getString(AVALON_LOGGER_FORMAT, "%{time} %{message}\\n%{throwable}");
level = (Priority) logLevels.get(rsvc.getString(AVALON_LOGGER_LEVEL, "warn"));
}
VelocityFormatter vf = new VelocityFormatter(format);
// make the target and keep the default behavior of not appending
FileTarget target = new FileTarget(new File(file), false, vf);
logger.setPriority(level);
logger.setLogTargets(new LogTarget[] { target });
log(DEBUG_ID, "AvalonLogChute initialized using file '"+file+'\'');
}
catch (IOException ioe)
{
rsvc.getLog().error("Unable to create log file for AvalonLogChute", ioe);
throw new Exception("Error configuring AvalonLogChute : " + ioe);
}
}
代码示例来源:origin: org.apache.velocity/com.springsource.org.apache.velocity
private void initTarget(final String file, final RuntimeServices rsvc) throws Exception
{
try
{
String format = null;
Priority level = null;
if (rsvc != null)
{
format = rsvc.getString(AVALON_LOGGER_FORMAT, "%{time} %{message}\\n%{throwable}");
level = (Priority) logLevels.get(rsvc.getString(AVALON_LOGGER_LEVEL, "warn"));
}
VelocityFormatter vf = new VelocityFormatter(format);
// make the target and keep the default behavior of not appending
FileTarget target = new FileTarget(new File(file), false, vf);
logger.setPriority(level);
logger.setLogTargets(new LogTarget[] { target });
log(DEBUG_ID, "AvalonLogChute initialized using file '"+file+'\'');
}
catch (IOException ioe)
{
rsvc.getLog().error("Unable to create log file for AvalonLogChute", ioe);
throw new Exception("Error configuring AvalonLogChute : " + ioe);
}
}
代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger
m_logkitLogger.setLogTargets( new LogTarget[] {logTarget} );
logger.setLogTargets( new LogTarget[]{logTarget} );
代码示例来源:origin: org.apache.excalibur.testcase/excalibur-testcase
logger.setLogTargets( new LogTarget[]{target} );
代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger
logger.setLogTargets( logTargets );
代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger
logger.setLogTargets( logTargets );
logger.setAdditivity( additive );
代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger
logger.setLogTargets( logTargets );
logger.setAdditivity( additive );
代码示例来源:origin: org.apache.avalon.framework/avalon-framework-impl
final LogKit2AvalonLoggerAdapter target =
new LogKit2AvalonLoggerAdapter( logger );
logKitLogger.setLogTargets( new LogTarget[ ] { target } );
代码示例来源:origin: org.apache.excalibur.component/excalibur-component
final LogKit2AvalonLoggerAdapter target =
new LogKit2AvalonLoggerAdapter( logger );
logkitLogger.setLogTargets( new LogTarget[ ] { target } );
内容来源于网络,如有侵权,请联系作者删除!