0

I am using log4j properties to capture the logs.i wants to remove error info from INFO file.

**

INFO

** file is below:

5:39:02,068 INFO BluSyncLauncher:156 - Application started

05:39:02,080 INFO BluSyncLauncher:586 - Loading UI 05:39:02,263 INFO BackupCrawlDAOImpl:470 - sqlExeception in CREATE_ACTIVITY_TABLEjava.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (duplicate column name: IsFolder)

05:39:02,264 **

ERROR

** BackupActivityHistoryDAOImpl:706 - sqlExeception in CREATE_ACTIVITY_TABLEjava.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (duplicate column name: restartid) 05:39:03,803 INFO BluSyncLauncher:533 - Started crawl (backup) 05:39:03,827 INFO BluSyncLauncher:543 - Starting Activity Timer 05:39:03,860 INFO BluSyncLauncher:557 - Load SystemTrayUI

05:39:10,612 **

ERROR

** BackupPolicyDAOImpl:280 - SQLException while inserting backup policy details java.sql.SQLException: [SQLITE_CONSTRAINT] Abort due to constraint violation (BACKUP_POLICY.policyGroupName may not be NULL) at org.sqlite.DB.newSQLException(DB.java:383) at org.sqlite.DB.newSQLException(DB.java:387) at org.sqlite.DB.execute(DB.java:342) at org.sqlite.PrepStmt.execute(PrepStmt.java:65) at com.parablu.epa.common.dao.BackupPolicyDAOImpl.insertBackupPolicyDetailsToTable(BackupPolicyDAOImpl.java:273) at com.parablu.epa.common.service.settings.PolicyManagementServerHelper.createGroupPolicyAndChildDetails(PolicyManagementServerHelper.java:306) at com.parablu.epa.common.service.settings.PolicyManagementServerHelper.loadBackupPolicyElement(PolicyManagementServerHelper.java:245) at com.parablu.epa.service.backup.LinuxCheckBackupPolicy.checkGroupPolicy(LinuxCheckBackupPolicy.java:140) at com.parablu.epa.service.alarm.LinuxPolicyRefreshHelper$1.run(LinuxPolicyRefreshHelper.java:55) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505)

adithyan .p
  • 121
  • 1
  • 3
  • 12

2 Answers2

0

Loggers may be assigned levels. The set of possible levels, that is:

TRACE,
DEBUG,
INFO,
WARN,
ERROR and
FATAL

are defined in the org.apache.log4j.Level class. Although we do not encourage you to do so,

you may define your own levels by sub-classing the Level class.

Level Inheritance

A logging request is said to be enabled if its level is higher than or equal to the level of its logger. Otherwise, the request is said to be disabled. A logger without an assigned level will inherit one from the hierarchy. This rule is summarized below.

Basic Selection Rule

A log request of level p in a logger with (either assigned or inherited, whichever is appropriate) level q, is enabled if p >= q.

UPDATE:

In Log4j2 version 2.0.2

If you wish to change the root logger level, do something like this :

LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
Configuration config = ctx.getConfiguration();
LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME); 
loggerConfig.setLevel(level);
ctx.updateLoggers();  // This causes all Loggers to refetch information from their LoggerConfig.
SkyWalker
  • 28,384
  • 14
  • 74
  • 132
0

I get some information from log4j filter

and read the log4j source code. I found it is possible. Do like this:

appender.File.type=File
appender.File.name=infolog
appender.File.layout.type=PatternLayout
appender.File.layout.pattern=%d %p %C{1.} [%t] %m%n
appender.File.filename=${infologfilename}
#here! add filter named star, type is ThresholdFilter
appender.File.filter.star.type=ThresholdFilter
#level you want to filter
appender.File.filter.star.level=info
#if mathched the level, the log higher then the level will not output
appender.File.filter.star.onMatch=DENY
#if mismathed,output
appender.File.filter.star.onMisMatch=ACCEPT

May be it can help you. I suggest you to use xml configuration,easy to read and edit.

star
  • 321
  • 2
  • 9