Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Log4J: Seperate log file for each Locale ?

 
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Query - how to seperate Logging in Spring based Java application based on Locale/Country code ?

For example - consider an Java web application which caters to multilingual website (let us say - supporting five languages - EN, CH, FR, DE, ES). Now, in my Java code, all log messages are going to same single log file.
Problem is - it is difficult to track/analyze country specific log file for analysis.

I want a behaviour that if any user of EN locale is logged in application, then, all activity he does on website get logged in seperate log file (say - en_webLogs.log), if any user of FR locale is logged in application, then, all activity he does on website get logged in seperate log file (say - fr_webLogs.log). So on and so forth.

Basically, seperate log file for each Locale. Please note that I want log messages in English language in all country logs. No language change there. Only depending upon which Locale User chose or belongs to , his activity need to track to his Locale specific logs.

I tried to search on google but could not find any solution.

So I have turned toward this forum to find solution.


Thanks
Abhay Agarwal
 
Sheriff
Posts: 24654
58
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may be that using the user's locale as the "Nested Diagnostic Context" might help in separating the logs by locale. Check that out in the documentation and see if it helps.
 
I have gone to look for myself. If I should return before I get back, keep me here with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!