vy commented on issue #3357:
URL: 
https://github.com/apache/logging-log4j2/issues/3357#issuecomment-2578558679

   > still can' find a way to get a layer from `LogEvent`. Layers don't have 
names. So, I need to give name manually, however, to get the name of the layer, 
I need at least `Module` or `Class` instances, but I can get only class string 
name, that can't provide what I need.
   
   @ranger2025, I don't know about module layers, but if what you're describing 
(i.e., having your hands on a `Class`/`Module` instance) is the only way to 
obtain the `ModuleLayer` so that you can filter, then I can assure you this 
will have a significant performance impact I doubt if you would want to pay for 
every single incoming log event.
   
   I recently rewrote the extended exception pattern converter (i.e., `%xEx`) 
of Pattern Layout and there I needed to go from a `StackTraceElement` 
(containing class name, etc.) to a `Class`, and it felt like a very ~nasty 
hack~ unpleasant experience. I wouldn't recommend that route to anyone.
   
   > About layers. I have a multi layer program where every layer is a 
subsystem. And often I need to get events only for concrete subsystem. As these 
subsystems can be added/removed dynamically I need a solution to separate them 
using java code.
   
   @ranger2025, the sophistication needed in your use case makes me question if 
there is a better alternative to your approach. Would you mind telling us a 
little bit more about your use case, please? Can you point us some other 
multi-layered (F/OSS?) applications we can investigate? Can you show us 
applications where the problem you describe (i.e., only allow logging from the 
concrete subsystem) exists?


-- 
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: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to