Skip to content

Commit

Permalink
FELIX-5866 : scr does not respect the log level set in LoggerAdmin
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1833438 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
cziegeler committed Jun 13, 2018
1 parent a8fe38f commit e86f3d1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ String getPrefix()
*/
public boolean isLogEnabled(final int level)
{
return config.getLogLevel() >= level
&& getLogger().isLogEnabled(level);
final InternalLogger l = getLogger();
return (!l.checkScrConfig() || config.getLogLevel() >= level)
&& l.isLogEnabled(level);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ InternalLogger getDefaultLogger()
{
return new InternalLogger()
{
@Override
public boolean checkScrConfig() {
return parent.getLogger().checkScrConfig();
}

@Override
public void log(final int level, final String message, final Throwable ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ interface InternalLogger {
void log(int level, String message, Throwable exception);

boolean isLogEnabled(int level);

boolean checkScrConfig();
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public boolean isLogEnabled(final int level)
return true;
}

@Override
public boolean checkScrConfig() {
return true;
}

@SuppressWarnings("deprecation")
@Override
public void log(final int level, final String message, final Throwable ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public R7LogServiceLogger(final Bundle bundle, final LogService loggerFactory, f
this.logger = ((LoggerFactory)loggerFactory).getLogger(bundle, name, Logger.class);
}

@Override
public boolean checkScrConfig() {
return false;
}

@Override
public boolean isLogEnabled(final int level)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
*/
class StdOutLogger implements InternalLogger
{

@Override
public boolean checkScrConfig() {
return true;
}

@Override
public void log(final int level, final String message, final Throwable ex)
{
Expand Down

0 comments on commit e86f3d1

Please sign in to comment.