Win a copy of Murach's MySQL this week in the JDBC and Relational Databases 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Add/Put Log4j messages to the Swing JTextField

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
This is the first time I am posting any messages to any forums . Hope someone may reply soon .

My Problem is how to add log4j messages to the Swing Jtextfield. How to use LF5Appender to add the messages to swing component. I have tried many things but It is not working .
Like one of the vague trial was to add the messages to the file and then read from the file but that would read old messages not the new ones which will be written . plus lots of other problems (null vlaues etc.)
Is there any way where I can directly guide my Logger messages to the swing JTextField or any other component without going to any other file etc.

Thanks and Regards

Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i don't know if you have run the examples included in the dist, but the bulk of the lf5 stuff is for logging to the lf5 gui console.

i don't think any of the lf5 packages is tailored to directly talk to misc swing component, but they do give you alternatives: you can pick up log messages from a socket, or from a database.

jswat is a good example - it can be configured for debugging using socket ipc

another option would be to write a wrapper to "tee" log messages to your app and also to log4j. [if you're familiar with the unix tee cmd...]

in unix, you have plenty of ipc options. but i must comment that this is potentially a very io-intensive task for a swing app, especially if you plan to handle it in a jtextfield - i think you'll prefer lf5 console once the swing q gets bottlenecked but

[and happy holidays!]
    Bookmark Topic Watch Topic
  • New Topic