Re[4]: Separate logging for JPMS module/layer

Alex Sviridov ooo_saturn7 at mail.ru
Wed Oct 3 14:58:09 UTC 2018


However, if code must depend on implementation is is a not good way - it is not robust,
it is hard to update. Seems there is no chance to make a good universal logger per module/layer as
we cannot get the Module/ModuleLayer of the class having only String className.


>Среда,  3 октября 2018, 1:37 +03:00 от forax at univ-mlv.fr:
>
>
>
>----------------------------------------------------------------------
>>De:  "Alex Sviridov" < ooo_saturn7 at mail.ru >
>>À:  "Remi Forax" < forax at univ-mlv.fr >, "jigsaw-dev" < jigsaw-dev at openjdk.java.net >
>>Envoyé:  Mercredi 3 Octobre 2018 00:20:08
>>Objet:  Re[2]: Separate logging for JPMS module/layer
>>Thank you for you suggestion. But can this be used when some library
>>uses one logging system and for another uses some bridge. Because of this bridging
>>LoggerFactory.getLogger is called somewhere in bridge, as I understand,
>
>You can still skip over the method of the bridge, but usually it only works if you know all the bridges that can happen because this code tend to be depend on the implementation of each bridge,
>practically, there is less than half a dozen of logging libraries used in Java, so it's doable.
>
>The other solution is to ask every maintainers of the logging libraries to implement the System.Logger API introduced in 9.
> 
>Rémi
>>
>>
>>
>>>Среда,  3 октября 2018, 1:12 +03:00 от Remi Forax < forax at univ-mlv.fr >:
>>>
>>>You can use the StackWalker
>>>https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/StackWalker.html
>>>
>>>regards,
>>>Rémi
>>>
>>>----- Mail original -----
>>>> De: "Alex Sviridov" < ooo_saturn7 at mail.ru >
>>>> À: "jigsaw-dev" < jigsaw-dev at openjdk.java.net >
>>>> Envoyé: Mardi 2 Octobre 2018 23:54:48
>>>> Objet: Separate logging for JPMS module/layer
>>>
>>>> Hi all,
>>>> 
>>>> Could anyone say how the following problem can be solved. I want to create
>>>> separate
>>>> log file for every JPMS module/layer. The problem is that many
>>>> libraries/programs
>>>> use LoggerFactory.getLogger(String className) so in getLogger I have only
>>>> the name of the class as String, so I can't get module and layer.
>>>> 
>>>> If I had not String className, but Class klass then the problem would be easily
>>>> solved.
>>>> As I understand I can't load class by name because it would require all modules
>>>> export
>>>> their packages to logging framework that has no sense.
>>>> 
>>>> Are there any solutions for such problem?
>>>> 
>>>> 
>>>> --
>>>> Alex Sviridov
>>
>>
>>-- 
>>Alex Sviridov


-- 
Alex Sviridov


More information about the jigsaw-dev mailing list