本文整理汇总了Java中org.jboss.logging.Logger类的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Logger类属于org.jboss.logging包,在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apiClient
import org.jboss.logging.Logger; //导入依赖的package包/类
@Produces
@Singleton
private ApiClient apiClient(Tracer tracer) {
String host = config.getValue(APIGATEWAY_URL, String.class);
String port = config.getValue(APIGATEWAY_PORT, String.class);
log.infof("API gateway expected at %s:%s", host, port);
return HystrixFeign.builder()
.client(new TracingClient(new ApacheHttpClient(HttpClientBuilder.create().build()), tracer))
.logger(new feign.Logger.ErrorLogger()).logLevel(feign.Logger.Level.BASIC)
.encoder(new JacksonEncoder())
.decoder(new JacksonDecoder())
.target(ApiClient.class, String.format("http://%s:%s", host, port),
(LRA lra) -> rx.Observable.empty());
}
示例2: configure
import org.jboss.logging.Logger; //导入依赖的package包/类
/**
* <p>
* Provide a hook for lazy configuration of this <code>Digester</code>
* instance. The default implementation does nothing, but subclasses
* can override as needed.
* </p>
*
* <p>
* <strong>Note</strong> This method may be called more than once.
* Once only initialization code should be placed in {@link #initialize}
* or the code should take responsibility by checking and setting the
* {@link #configured} flag.
* </p>
*/
protected void configure() {
// Do not configure more than once
if (configured) {
return;
}
log = Logger.getLogger("org.apache.commons.digester.Digester");
saxLog = Logger.getLogger("org.apache.commons.digester.Digester.sax");
// Perform lazy configuration as needed
initialize(); // call hook method for subclasses that want to be initialized once only
// Nothing else required by default
// Set the configuration flag to avoid repeating
configured = true;
}
示例3: resolveEntity
import org.jboss.logging.Logger; //导入依赖的package包/类
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException {
for (int i = 0; i < Constants.CACHED_DTD_PUBLIC_IDS.length; i++) {
String cachedDtdPublicId = Constants.CACHED_DTD_PUBLIC_IDS[i];
if (cachedDtdPublicId.equals(publicId)) {
String resourcePath = Constants.CACHED_DTD_RESOURCE_PATHS[i];
InputStream input = this.getClass().getResourceAsStream(
resourcePath);
if (input == null) {
throw new SAXException(Localizer.getMessage(
"jsp.error.internal.filenotfound", resourcePath));
}
InputSource isrc = new InputSource(input);
return isrc;
}
}
Logger log = Logger.getLogger(MyEntityResolver.class);
if (log.isDebugEnabled())
log.debug("Resolve entity failed" + publicId + " " + systemId);
log.error(Localizer.getMessage("jsp.error.parse.xml.invalidPublicId",
publicId));
return null;
}
示例4: testNothing
import org.jboss.logging.Logger; //导入依赖的package包/类
@Test
public void testNothing() {
Logger gouda = Logger.getLogger( "cheese.gouda" );
gouda.info( "gouda info" );
gouda.debug( "gouda debug");
assertTrue( gouda.isTraceEnabled() );
assertTrue( gouda.isDebugEnabled() );
assertTrue( gouda.isInfoEnabled() );
Logger cheddar = Logger.getLogger( "cheese.cheddar" );
cheddar.info( "cheddar info" );
cheddar.debug( "cheddar debug" );
assertFalse( cheddar.isTraceEnabled() );
assertFalse( cheddar.isDebugEnabled() );
assertFalse( cheddar.isInfoEnabled() );
}
示例5: doLogging
import org.jboss.logging.Logger; //导入依赖的package包/类
@Test
public void doLogging() throws FileNotFoundException {
String message = "testing: " + UUID.randomUUID().toString();
Logger logger = Logger.getLogger("br.org.sistemafieg.cliente");
logger.info(message);
assertTrue("File not found: " + logFile, new File(logFile).exists());
BufferedReader reader = new BufferedReader(new FileReader(logFile));
List<String> lines = reader.lines().collect(Collectors.toList());
boolean found = false;
for (String line : lines) {
if (line.contains(message)) {
found = true;
break;
}
}
assertTrue("Expected message " + message, found);
}
示例6: testNothing
import org.jboss.logging.Logger; //导入依赖的package包/类
@Test
public void testNothing() {
Logger gouda = Logger.getLogger( "cheese.gouda" );
gouda.info( "gouda info" );
gouda.debug( "gouda debug");
assertFalse( gouda.isTraceEnabled() );
assertFalse( gouda.isDebugEnabled() );
assertTrue( gouda.isInfoEnabled() );
Logger cheddar = Logger.getLogger( "cheese.cheddar" );
cheddar.info( "cheddar info" );
cheddar.debug( "cheddar debug" );
assertFalse( cheddar.isTraceEnabled() );
assertFalse( cheddar.isDebugEnabled() );
assertTrue( cheddar.isInfoEnabled() );
}
示例7: getLevel
import org.jboss.logging.Logger; //导入依赖的package包/类
@Override
public Object getLevel() {
if (this.logger.isEnabled(Logger.Level.TRACE)) {
return "TRACE";
}
if (this.logger.isEnabled(Logger.Level.DEBUG)) {
return "DEBUG";
}
if (this.logger.isEnabled(Logger.Level.INFO)) {
return "INFO";
}
if (this.logger.isEnabled(Logger.Level.WARN)) {
return "WARN";
}
if (this.logger.isEnabled(Logger.Level.ERROR)) {
return "ERROR";
}
return "UNKNOWN";
}
示例8: messageChunkSent
import org.jboss.logging.Logger; //导入依赖的package包/类
public static void messageChunkSent() {
messageChunkCount++;
try {
if (messageChunkCount == 10) {
liveServer.fail(true);
System.err.println("activating");
if (!backupServer.waitForActivation(1, TimeUnit.MINUTES)) {
Logger.getLogger(LargeMessageOverReplicationTest.class).warn("Can't failover server");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例9: main
import org.jboss.logging.Logger; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
// 2. Specify the alternate log manager as a system property
System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
// 3. Configure Programmtically
String logLevel = "TRACE";
String logFile = "target/jboss-logging-programmtically.log";
PropertyConfigurator configurator = new PropertyConfigurator();
configurator.configure(createLogManagerConfig(logLevel, logFile));
// 4. Initialize a Logger
Logger logger = Logger.getLogger(JBossLoggingExample.class);
// 5. logging the message
logger.trace("TRACE Message");
logger.debug("DEBUG Message");
logger.info("INFO Message");
logger.warn("WARN Message");
logger.error("Error Message");
logger.fatal("FATAL Message");
}
示例10: testConstructedInterfaceName
import org.jboss.logging.Logger; //导入依赖的package包/类
@Test
public void testConstructedInterfaceName() throws Exception
{
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
builder = builder.address(URL);
builder = builder.serviceName(SERVICE_QNAME);
builder = builder.endpointName(PORT_QNAME);
builder = builder.interfaceName(PORT_TYPE_QNAME);
builder = builder.wsdlDocumentLocation(WSDL_URL);
Element element = DOMUtils.parse(XML_REF_PARAM1);
builder = builder.referenceParameter(element);
element = DOMUtils.parse(XML_REF_PARAM2);
builder = builder.referenceParameter(element);
W3CEndpointReference epr = builder.build();
DOMResult dr = new DOMResult();
epr.writeTo(dr);
Node endpointReferenceElement = dr.getNode();
Logger.getLogger(this.getClass()).info(DOMUtils.node2String(endpointReferenceElement));
assertMetaData(endpointReferenceElement);
assertRefParam(endpointReferenceElement, PARAM1_QNAME, "Hello");
assertRefParam(endpointReferenceElement, PARAM2_QNAME, "World");
}
示例11: getLogger
import org.jboss.logging.Logger; //导入依赖的package包/类
/**
* Return the Logger with which this Container is associated. If there is
* no associated Logger, return the Logger associated with our parent
* Container (if any); otherwise return <code>null</code>.
*/
public Logger getLogger() {
if (logger != null)
return (logger);
logger = Logger.getLogger(logName());
return (logger);
}
示例12: warning
import org.jboss.logging.Logger; //导入依赖的package包/类
public void warning(SAXParseException ex) throws SAXException {
Logger log = Logger.getLogger(MyErrorHandler.class);
if (log.isDebugEnabled())
log.debug("ParserUtils: warning ", ex);
// We ignore warnings
}
示例13: handleCustomLog
import org.jboss.logging.Logger; //导入依赖的package包/类
private void handleCustomLog(HttpServerExchange exchange, Throwable t, Logger.Level level, Logger.Level stackTraceLevel, String category) {
BasicLogger logger = UndertowLogger.REQUEST_LOGGER;
if (!category.isEmpty()) {
logger = Logger.getLogger(category);
}
boolean stackTrace = true;
if (stackTraceLevel.ordinal() > level.ordinal()) {
if (!logger.isEnabled(stackTraceLevel)) {
stackTrace = false;
}
}
if (stackTrace) {
logger.logf(level, t, "Exception handling request to %s", exchange.getRequestURI());
} else {
logger.logf(level, "Exception handling request to %s: %s", exchange.getRequestURI(), t.getMessage());
}
}
示例14: onException
import org.jboss.logging.Logger; //导入依赖的package包/类
public static Response onException(Exception e, Logger log) {
if (e instanceof IllegalArgumentException) {
return badRequest(e.getMessage());
}
if (null != e.getCause() && e.getCause() instanceof IllegalArgumentException) {
return badRequest(e.getCause().getMessage());
}
if (null != log) {
log.debug(e.getMessage(), e);
}
return internalError(e.getMessage());
}
示例15: testCustomCategory
import org.jboss.logging.Logger; //导入依赖的package包/类
@Test
public void testCustomCategory() {
Logger logger = Logger.getLogger("custom.category");
logger.info("gouda info");
logger.debug("gouda debug");
logger.trace("gouda trace");
assertFalse(logger.isTraceEnabled());
assertTrue(logger.isDebugEnabled());
assertTrue(logger.isInfoEnabled());
}