• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Want to maintain different logs for different users using log4j

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my application, currently we are maintaining all logs in same file of Log4j. Instead of that, i want to maintain logs seperatly depend-upon his user-type. Whenever a specific user has get login, his information has been maintain in a specific file, all other user has get login, same type as previous user, being maintain in same file. When different type of user has get login, his information should maintain in different file. As per considering my requirement, please suggest some helpful idias and also code snipets.
Thanks and Regards,
Gajendra Pingalkar
 
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that's rather a log4j but a struts question...

so you want different log-configurations for different users?

i dont think that it is the intention of a logging framework to log "per user". a log file is something technical, which is supposed to help us coders, not to form a new presentation layer.

if i understood you correctly, it all does not make much sense to me.

but anyhow:

should i need to implement this, i'd probably wrap the logging calls from to .

the wrapper-class would then decide which log configuration is appropriate and which (concrete) logger to use... the log4j configuration would be a superset of all possible loggers / handlers.

hope it helps,
jan
[ January 16, 2007: Message edited by: Jan Groth ]
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This kind of question gets asked a lot, but it's not something I have done.

You should look at NDC/MDC, for example there's some info on NDC vs MDC on the log4j wiki.

Using NDC or MDC with filters you may be able to do what you are asking for. You could search the mailing list archives (link on the wiki), or perhaps the answer may be found in the "Other Open Source" forum (including log4j).
[ January 16, 2007: Message edited by: Carol Enderlin ]
 
Get me the mayor's office! I need to tell him about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic