Java Code Examples for org.apache.log4j.Level#DEBUG
The following examples show how to use
org.apache.log4j.Level#DEBUG .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertyFileReader.java From SeleniumCucumber with GNU General Public License v3.0 | 6 votes |
public Level getLoggerLevel() { switch (prop.getProperty("Logger.Level")) { case "DEBUG": return Level.DEBUG; case "INFO": return Level.INFO; case "WARN": return Level.WARN; case "ERROR": return Level.ERROR; case "FATAL": return Level.FATAL; } return Level.ALL; }
Example 2
Source File: IngestUtilities.java From cognition with Apache License 2.0 | 6 votes |
public static Level levelFromString(String level) { String ulevel = level.toUpperCase(); if (ulevel.equals("ALL")) { return Level.ALL; } else if (ulevel.equals("DEBUG")) { return Level.DEBUG; } else if (ulevel.equals("ERROR")) { return Level.ERROR; } else if (ulevel.equals("FATAL")) { return Level.FATAL; } else if (ulevel.equals("INFO")) { return Level.INFO; } else if (ulevel.equals("OFF")) { return Level.OFF; } else if (ulevel.equals("TRACE")) { return Level.TRACE; } else if (ulevel.equals("WARN")) { return Level.WARN; } return Level.INFO; }
Example 3
Source File: LogEventAdapter.java From logging-log4j2 with Apache License 2.0 | 6 votes |
/** * Return the level of this event. Use this form instead of directly * accessing the <code>level</code> field. */ @Override public Level getLevel() { switch (StandardLevel.getStandardLevel(event.getLevel().intLevel())) { case TRACE: return Level.TRACE; case DEBUG: return Level.DEBUG; case INFO: return Level.INFO; case WARN: return Level.WARN; case FATAL: return Level.FATAL; case OFF: return Level.OFF; case ALL: return Level.ALL; default: return Level.ERROR; } }
Example 4
Source File: FragmenterResource.java From pxf with Apache License 2.0 | 6 votes |
private void logFragmentStatistics(Level level, RequestContext context, List<Fragment> fragments) { int numberOfFragments = fragments.size(); SessionId session = new SessionId(context.getSegmentId(), context.getTransactionId(), context.getUser(), context.getServerName()); long elapsedMillis = System.currentTimeMillis() - startTime; if (level == Level.INFO) { LOG.info("{} returns {} fragment{} for path {} in {} ms for {} [profile {} filter is{} available]", context.getFragmenter(), numberOfFragments, numberOfFragments == 1 ? "" : "s", context.getDataSource(), elapsedMillis, session, context.getProfile(), context.hasFilter() ? "" : " not"); } else if (level == Level.DEBUG) { LOG.debug("{} returns {} fragment{} for path {} in {} ms for {} [profile {} filter is{} available]", context.getFragmenter(), numberOfFragments, numberOfFragments == 1 ? "" : "s", context.getDataSource(), elapsedMillis, session, context.getProfile(), context.hasFilter() ? "" : " not"); } }
Example 5
Source File: Log4jSyslogBackLogHandler.java From syslog4j-graylog2 with GNU Lesser General Public License v2.1 | 6 votes |
protected static Level getLog4jLevel(int level) { switch (level) { case SyslogConstants.LEVEL_DEBUG: return Level.DEBUG; case SyslogConstants.LEVEL_INFO: return Level.INFO; case SyslogConstants.LEVEL_NOTICE: return Level.INFO; case SyslogConstants.LEVEL_WARN: return Level.WARN; case SyslogConstants.LEVEL_ERROR: return Level.ERROR; case SyslogConstants.LEVEL_CRITICAL: return Level.ERROR; case SyslogConstants.LEVEL_ALERT: return Level.ERROR; case SyslogConstants.LEVEL_EMERGENCY: return Level.FATAL; default: return Level.WARN; } }
Example 6
Source File: Log4jTest.java From sofa-common-tools with Apache License 2.0 | 6 votes |
@Test public void testLocalProperties() throws NoSuchFieldException, IllegalAccessException { LoggerRepository repo2 = new Hierarchy(new RootLogger((Level) Level.DEBUG)); URL url2 = LogbackTest.class.getResource("/com/alipay/sofa/rpc/log/log4j/log4j_b.xml"); DOMConfigurator domConfigurator = new DOMConfigurator(); Field field = DOMConfigurator.class.getDeclaredField("props"); field.setAccessible(true); Properties props = new Properties(); field.set(domConfigurator, props); props.put("hello", "defaultb"); domConfigurator.doConfigure(url2, repo2); Logger logger2 = repo2.getLogger("com.foo.Bar3"); Assert.assertTrue(logger2.getAllAppenders().hasMoreElements()); }
Example 7
Source File: Log4jLoggerAdapter.java From HttpSessionReplacer with MIT License | 6 votes |
@Override public void log(Marker marker, String callerFQCN, int level, String msg, Object[] argArray, Throwable t) { Level log4jLevel; switch (level) { case LocationAwareLogger.TRACE_INT: log4jLevel = traceCapable ? Level.TRACE : Level.DEBUG; break; case LocationAwareLogger.DEBUG_INT: log4jLevel = Level.DEBUG; break; case LocationAwareLogger.INFO_INT: log4jLevel = Level.INFO; break; case LocationAwareLogger.WARN_INT: log4jLevel = Level.WARN; break; case LocationAwareLogger.ERROR_INT: log4jLevel = Level.ERROR; break; default: throw new IllegalStateException("Level number " + level + " is not recognized."); } logger.log(callerFQCN, log4jLevel, msg, t); }
Example 8
Source File: AbstractAtdl4jConfiguration.java From atdl4j with MIT License | 5 votes |
public void setDebugLoggingLevel( boolean aDebugLevelFlag ) { Level tempLevel = Level.INFO; if ( aDebugLevelFlag ) { tempLevel = Level.DEBUG; } logger.info( "setDebugLoggingLevel( " + aDebugLevelFlag + " ) invoking org.apache.log4j.Logger.getLogger( " + ATDL4J_PACKAGE_NAME_PATH_FOR_DEBUG_LOGGING + " ).setLevel( " + tempLevel + " )" ); Logger.getLogger( ATDL4J_PACKAGE_NAME_PATH_FOR_DEBUG_LOGGING ).setLevel( tempLevel ); // -- explicitly set ourself, too -- logger.setLevel( tempLevel ); }
Example 9
Source File: LevelMatchFilterTestCase.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void accept() throws Exception { // set up appender Layout layout = new SimpleLayout(); Appender appender = new FileAppender(layout, ACCEPT_FILE, false); // create LevelMatchFilter LevelMatchFilter matchFilter = new LevelMatchFilter(); // attach match filter to appender appender.addFilter(matchFilter); // attach DenyAllFilter to end of filter chain to deny neutral // (non matching) messages appender.addFilter(new DenyAllFilter()); // set appender on root and set level to debug root.addAppender(appender); root.setLevel(Level.TRACE); Level[] levelArray = new Level[] {Level.TRACE, Level.DEBUG, Level.INFO, Level.WARN, Level.ERROR, Level.FATAL}; for (int x = 0; x < levelArray.length; x++) { // set the level to match matchFilter.setLevelToMatch(levelArray[x].toString()); common("pass " + x + "; filter set to accept only " + levelArray[x].toString() + " msgs"); } Transformer.transform(ACCEPT_FILE, ACCEPT_FILTERED, new LineNumberFilter()); assertTrue(Compare.compare(ACCEPT_FILTERED, ACCEPT_WITNESS)); }
Example 10
Source File: AbstractLoggingBoltTest.java From cognition with Apache License 2.0 | 5 votes |
@Test public void testLogDebug(@Injectable Logger logger) throws Exception { bolt.level = Level.DEBUG; new Expectations() {{ logger.debug("msg"); }}; bolt.log(logger, "msg"); }
Example 11
Source File: Appender.java From 07kit with GNU General Public License v3.0 | 5 votes |
@Override public void append(LoggingEvent event) { if (event.getLevel() == Level.DEBUG) { return; } super.append(event); }
Example 12
Source File: OraOopUtilities.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 5 votes |
public static boolean enableDebugLoggingIfRequired( org.apache.hadoop.conf.Configuration conf) { boolean result = false; try { Level desiredOraOopLoggingLevel = Level.toLevel(conf.get(OraOopConstants.ORAOOP_LOGGING_LEVEL), Level.INFO); Level sqoopLogLevel = Logger.getLogger(Sqoop.class.getName()).getParent().getLevel(); if (desiredOraOopLoggingLevel == Level.DEBUG || desiredOraOopLoggingLevel == Level.ALL || sqoopLogLevel == Level.DEBUG || sqoopLogLevel == Level.ALL) { Category oraOopLogger = Logger.getLogger(OraOopManagerFactory.class.getName()).getParent(); oraOopLogger.setLevel(Level.DEBUG); LOG.debug("Enabled OraOop debug logging."); result = true; conf.set(OraOopConstants.ORAOOP_LOGGING_LEVEL, Level.DEBUG.toString()); } } catch (Exception ex) { LOG.error(String.format( "Unable to determine whether debug logging should be enabled.\n%s", getFullExceptionMessage(ex))); } return result; }
Example 13
Source File: Log4j.java From pegasus with Apache License 2.0 | 5 votes |
/** * Sets the debug level. All those messages are logged which have a level less than equal to the * debug level. In case the boolean info is set, all the info messages are also logged. * * @param level the level to which the debug level needs to be set to. * @param info boolean denoting whether the INFO messages need to be logged or not. */ protected void setLevel(int level, boolean info) { Level l = Level.ALL; switch (level) { case LogManager.FATAL_MESSAGE_LEVEL: l = Level.FATAL; break; case LogManager.ERROR_MESSAGE_LEVEL: l = Level.ERROR; break; case LogManager.WARNING_MESSAGE_LEVEL: l = Level.WARN; break; case LogManager.CONFIG_MESSAGE_LEVEL: l = Level.INFO; break; case LogManager.INFO_MESSAGE_LEVEL: l = Level.INFO; break; case LogManager.DEBUG_MESSAGE_LEVEL: l = Level.DEBUG; break; } mLogger.setLevel(l); }
Example 14
Source File: AppSelSiteProcessor.java From swift-k with Apache License 2.0 | 4 votes |
public Level getSupportedLevel() { return Level.DEBUG; }
Example 15
Source File: ForeachItEndProcessor.java From swift-k with Apache License 2.0 | 4 votes |
public Level getSupportedLevel() { return Level.DEBUG; }
Example 16
Source File: ConfigManageController.java From openzaly with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @RequestMapping(method = RequestMethod.POST, value = "/updateConfig") @ResponseBody public String updateSiteConfig(HttpServletRequest request, @RequestBody byte[] bodyParam) { try { PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam); String siteUserId = getRequestSiteUserId(pluginPackage); if (!isManager(siteUserId)) { throw new UserPermissionException("Current user is not a manager"); } Map<String, String> dataMap = GsonUtils.fromJson(pluginPackage.getData(), Map.class); logger.info("siteUserId={} update config={}", siteUserId, dataMap); Map<Integer, String> configMap = new HashMap<Integer, String>(); if (StringUtils.isNotEmpty(trim(dataMap.get("site_name")))) { configMap.put(ConfigProto.ConfigKey.SITE_NAME_VALUE, trim(dataMap.get("site_name"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("site_address")))) { configMap.put(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE, trim(dataMap.get("site_address"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("site_port")))) { configMap.put(ConfigProto.ConfigKey.SITE_PORT_VALUE, trim(dataMap.get("site_port"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("group_members_count")))) { configMap.put(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE, trim(dataMap.get("group_members_count"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("pic_path")))) { configMap.put(ConfigProto.ConfigKey.PIC_PATH_VALUE, trim(dataMap.get("pic_path"))); } if (StringUtils.isNotEmpty(dataMap.get("site_logo"))) { configMap.put(ConfigProto.ConfigKey.SITE_LOGO_VALUE, dataMap.get("site_logo")); } if (StringUtils.isNotEmpty(dataMap.get("uic_status"))) { configMap.put(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE, dataMap.get("uic_status")); } if (StringUtils.isNotEmpty(dataMap.get("realName_status"))) { configMap.put(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE, dataMap.get("realName_status")); } if (StringUtils.isNotEmpty(dataMap.get("u2_encryption_status"))) { configMap.put(ConfigProto.ConfigKey.U2_ENCRYPTION_STATUS_VALUE, dataMap.get("u2_encryption_status")); } if (StringUtils.isNotEmpty(dataMap.get("add_friends_status"))) { configMap.put(ConfigProto.ConfigKey.CONFIG_FRIEND_REQUEST_VALUE, dataMap.get("add_friends_status")); } if (StringUtils.isNotEmpty(dataMap.get("create_groups_status"))) { configMap.put(ConfigProto.ConfigKey.CONFIG_CREATE_GROUP_VALUE, dataMap.get("create_groups_status")); } if (StringUtils.isNotEmpty(dataMap.get("group_qrcode_expire_time"))) { configMap.put(ConfigProto.ConfigKey.GROUP_QR_EXPIRE_TIME_VALUE, dataMap.get("group_qrcode_expire_time")); } if (StringUtils.isNotEmpty(dataMap.get("push_client_status"))) { configMap.put(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS_VALUE, dataMap.get("push_client_status")); } if (StringUtils.isNotEmpty(dataMap.get("log_level"))) { String logLevel = dataMap.get("log_level"); configMap.put(ConfigProto.ConfigKey.LOG_LEVEL_VALUE, logLevel); Level level = Level.INFO; if ("DEBUG".equalsIgnoreCase(logLevel)) { level = Level.DEBUG; } else if ("ERROR".equalsIgnoreCase(logLevel)) { level = Level.ERROR; } // 更新日志级别 AkxLog4jManager.setLogLevel(level); } // 普通管理员无权限 if (isAdmin(siteUserId) && StringUtils.isNotEmpty(trim(dataMap.get("site_manager")))) { configMap.put(ConfigProto.ConfigKey.SITE_MANAGER_VALUE, trim(dataMap.get("site_manager"))); } if (configManageService.updateSiteConfig(siteUserId, configMap)) { return SUCCESS; } } catch (InvalidProtocolBufferException e) { logger.error("update site config error", e); } catch (UserPermissionException u) { logger.error("update site config error : " + u.getMessage()); return NO_PERMISSION; } return ERROR; }
Example 17
Source File: AppThreadProcessor.java From swift-k with Apache License 2.0 | 4 votes |
public Level getSupportedLevel() { return Level.DEBUG; }
Example 18
Source File: ProcedureStartProcessor.java From swift-k with Apache License 2.0 | 4 votes |
public Level getSupportedLevel() { return Level.DEBUG; }
Example 19
Source File: TaskProcessor.java From swift-k with Apache License 2.0 | 4 votes |
public Level getSupportedLevel() { return Level.DEBUG; }
Example 20
Source File: ConfigurationProcessor.java From swift-k with Apache License 2.0 | 4 votes |
public Level getSupportedLevel() { return Level.DEBUG; }