I want to write log files based on module name. for ex. one log file for user management module and one for products module etc.
My project package structure looks like below;
com.mycompany.service.user
com.mycompany.service.product
com.mycompany.controller.user
com.mycompany.controller.product
...
I want to write log messages from
com.mycompany.*.user
(com.mycompany.service.user and com.mycompany.controller.user) to com.mycompany.user.log
file,
and com.mycompany.*.product
to com.mycompany.user.log
file.
I know I can create loggers like bellow
<logger name="com.mycompany.service.user" level="INFO">
<AppenderRef ref="AppenderUsers" />
</logger>
<logger name="com.mycompany.controller.user" level="INFO">
<AppenderRef ref="AppenderUsers" />
</logger>
...
But this way I have to add so many loggers.
Cant I use wildcard *
or **
or regex to logger name somethihng like this?
<logger name="com.mycompany.*.user" level="INFO">
<AppenderRef ref="AppenderUsers" />
</logger>
Or is there any way to do this?