apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willet Vary <wil...@datatorrent.com>
Subject APEX-CORE searchLoggersLevel and setLoggersLevel APIs
Date Fri, 21 Oct 2016 18:00:15 GMT
The current apex-core code supports two APIs:

1. searchLoggersLevel, which will search for existing log levels in the
executing application
2. setLoggersLevel, which will set log levels fro the executing application

With regard to searching existing log levels, the following search patterns
are valid:

.*
com.*
.*data.*
.*web.*|.*app.*
.*server

You can see the code in StramWebServices.java, function searchLoggersLevel.

However, when it comes to setting log levels, here are the results:

.*                 <<<< returns an incorrect logger settings
com.*              <<< is valid
.*data.*           <<<< returns an incorrect logger settings
.*web.*|.*app.*    <<<< returns an incorrect logger settings
.*server           <<<< returns an incorrect logger settings

The reason for this is when we set the log levels, we
call ConfigValidator.validateLoggersLevel to validate the regular
expressions before we set the levels.
The current code to test the input regular expression is as follow:

private static Pattern LOGGERS_PATTERN =
Pattern.compile("^(\\w+\\.?)+(\\*|\\w+)$");

According to this test, the specified expression must start with one an
alpha or number.  Followed by an optional period.  After that, an asterisk
or an alpha (or number) is required.

With that test, these are valid expressions:

a*
ab
a.*
a.b
a.b.*

So if we wanted to set log levels for all packages and classes with names
containing the word data, web or app, we can't.
I think we should expand the set log level regular expressions validation
to match the search regular expression validation, which is as long as it's
a valid regular expression, accept it.

If the suggestion is accepted, then these patterns should work when setting
log levels:

.*
com.*
org.*
com.*|org.*
.*data.*
.*web.*|.*app.*
.*server


Thanks,

Willet

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message