NopeCharon opened a new issue, #821:
URL: https://github.com/apache/logging-log4cxx/issues/821

   The [LocationInfoFilter 
documentation](https://logging.apache.org/log4cxx/latest_stable/filters.html#location-info-filter)
 says the `Method` option value "may be compiler-specific. On GCC, the method 
name will look like `Class::methodName`". But `LocationInfoFilter::decide` 
compares the option value with `LocationInfo::getMethodName()`, which removes 
the return type, the class and namespace names and the parameter list from 
`__PRETTY_FUNCTION__`/`__FUNCSIG__`. A qualified value such as 
`Class::methodName` can never match, so the filter silently does nothing.
   
   For a logging request in `void ns::Example::exampleFun(int)`:
   
   | `Method` value | Result |
   | --- | --- |
   | `exampleFun` | matches |
   | `Example::exampleFun` (as documented) | never matches |
   | `ns::Example::exampleFun` | never matches |
   
   Also, `LocationInfoFilter::setOption` begins with a leftover 
`LogLog::warn(option + ":" + value)`, so every option of every 
`LocationInfoFilter` in a configuration file writes a warning (e.g. `log4cxx: 
LineNumber:182`) to stderr, even when internal debugging is off.
   
   Reproduction (current master):
   
   ```cpp
   spi::LocationInfo li("/path/to/foo.cpp", "foo.cpp", "void 
ns::Example::exampleFun(int)", 50);
   auto event = std::make_shared<spi::LoggingEvent>(LOG4CXX_STR("test"), 
Level::getInfo(), LOG4CXX_STR("msg"), li);
   filter::LocationInfoFilter f;
   f.setOption(LOG4CXX_STR("Method"), LOG4CXX_STR("Example::exampleFun")); // 
prints "log4cxx: Method:Example::exampleFun" warning
   f.setOption(LOG4CXX_STR("AcceptOnMatch"), LOG4CXX_STR("false"));         // 
prints "log4cxx: AcceptOnMatch:false" warning
   f.decide(event); // NEUTRAL, expected DENY
   ```
   
   Expected: a `Method` value qualified by its class and/or namespace names 
(`Example::exampleFun`, `ns::Example::exampleFun`) matches the method, an 
unqualified value keeps working, and setting an option does not write a warning.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [I] LocationInfoFilter never mat... NopeCharon (via GitHub) via notifications

Reply via email to