本文整理汇总了Java中org.restlet.service.LogService类的典型用法代码示例。如果您正苦于以下问题:Java LogService类的具体用法?Java LogService怎么用?Java LogService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogService类属于org.restlet.service包,在下文中一共展示了LogService类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Component
import org.restlet.service.LogService; //导入依赖的package包/类
/**
* Constructor.
*/
public Component() {
super();
this.hosts = new CopyOnWriteArrayList<VirtualHost>();
this.clients = new ClientList(null);
this.servers = new ServerList(null, this);
this.realms = new CopyOnWriteArrayList<Realm>();
this.services = new ServiceList(getContext());
if (Engine.getInstance() != null) {
// To be done before setting the helper...
this.services.add(new org.restlet.service.TaskService());
this.helper = new ComponentHelper(this);
Context childContext = getContext().createChildContext();
this.defaultHost = new VirtualHost(childContext);
this.internalRouter = new InternalRouter(childContext);
this.services.add(new LogService());
getLogService().setContext(childContext);
this.services.add(new StatusService());
this.clients.setContext(childContext);
this.servers.setContext(childContext);
}
}
示例2: createComponent
import org.restlet.service.LogService; //导入依赖的package包/类
@Override
protected Component createComponent() {
Component component = super.createComponent();
// a bit more configuration by initParams
LogService log = component.getLogService();
// allow access to the LogService in the application via the context
component.getContext().getAttributes().put(LogService.class.getName(), log);
// modify the logger name
String loggerName = getInitParameter(LOGGER_NAME_ATTRIBUTE, LOGGER_NAME_ATTRIBUTE_DEFAULT_VALUE);
log.setLoggerName(loggerName);
// modify the logger pattern
// note: overridden to be smaller than the restlet default value
log.setResponseLogFormat(getInitParameter(LOGGER_FORMAT_ATTRIBUTE, LOGGER_FORMAT_ATTRIBUTE_DEFAULT_VALUE));
return component;
}
示例3: LogFilter
import org.restlet.service.LogService; //导入依赖的package包/类
/**
* Constructor.
*
* @param context
* The context.
* @param logService
* The log service descriptor.
*/
public LogFilter(Context context, LogService logService) {
super(context);
this.logService = logService;
if (logService != null) {
if (logService.getLoggerName() != null) {
this.logLogger = Engine.getLogger(logService.getLoggerName());
} else {
this.logLogger = Engine.getLogger(LogUtils.getBestClassName(logService.getClass()));
}
}
}
示例4: main
import org.restlet.service.LogService; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
NATPuncher.init();
GameMatcher.init();
Component component = new Component();
component.setLogService(new LogService(false));
component.getServers().add(Protocol.HTTP, Constants.RESTLET_PORT);
component.getDefaultHost().attach(new Main());
component.start();
}
示例5: getLogService
import org.restlet.service.LogService; //导入依赖的package包/类
/**
* Returns the global log service. On the first call, if no log service was
* defined via the {@link #setLogService(LogService)} method, then a default
* logger service is created. This service will be enabled by default and
* has a logger name composed the "org.restlet." prefix followed by the
* simple component class name (without packages), followed by the
* ".LogService" suffix.
*
* @return The global log service.
*/
public LogService getLogService() {
return getServices().get(LogService.class);
}
示例6: setLogService
import org.restlet.service.LogService; //导入依赖的package包/类
/**
* Sets the global log service.
*
* @param logService
* The global log service.
*/
public void setLogService(LogService logService) {
getServices().set(logService);
}