• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

how to add LOG function in richfaces

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys recently i got a project buid a website using richfaces and in my case my boss ask me to add some function call log,,
so whenenever someone want to update, delete or insert the data which already changed would be stored in table and we know the changes from old to new data
would you please guys help me??
how to solve that problem because i am new in richfaces,,
thanks alot gb
 
Ranch Hand
Posts: 41
Google Web Toolkit Tomcat Server Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the managed bean, with in use the log4j or even better use sl4j.
 
leonardo ginting
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

H Jetly wrote:Use the managed bean, with in use the log4j or even better use sl4j.





hi jetly thanks for replied my message btw i am new in richfaces honestly i have no idea how to add log4j in my case because i just learned would please show me how
 
H Jetly
Ranch Hand
Posts: 41
Google Web Toolkit Tomcat Server Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like you to be able to answer these questions before I can help you with logging.
1. Do you know anything about JSF/Java
2.Do you know how to create a managed bean ?

 
Greenhorn
Posts: 10
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use Interceptors (JEE6).

- Create your own interceptor annotation
- Place this annotation on the methods in your managed bean or any other method (CRUD methods) that you want to log
- Create an interceptor class, and use reflection to log the method that was called, the parameters, etc.
- Configure your application server logging settings so every log from your interceptor class gets stored in a seperate log file.

Interceptors are a very useful tool to create trace logs.


 
leonardo ginting
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

H Jetly wrote:I would like you to be able to answer these questions before I can help you with logging.
1. Do you know anything about JSF/Java
2.Do you know how to create a managed bean ?





Hi Jetly to be honest i am new in richfaces but if you told me how to made manage bean, yes i know,, but just litlle bit and you know i am so glad if want to teach me how,,
and exactly i'll be learn very hard
thanks buddy i'm so glad you replied my message
blessed you more buddy hopefully we could meet in indonesia
i am sorry if my leanguage is bad because i just learned english
 
H Jetly
Ranch Hand
Posts: 41
Google Web Toolkit Tomcat Server Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Leonardo,
thanks
See to start off, if you know how to use the managed bean then you are already 70 % in to the task.
Every CRUD (Create, Read, Update, Delete) on your db has to be logged on to a log file, if I am not wrong?
All this will happen by calling a method on the managed bean, all you have to do is use an opensource logging framework
The likes of
1. log4j
2. sl4j

I have worked with log4j all you have to do this mention in the log4j.config file as to what appender you are using (writing to a file, console, etc) and then instantiate the logger class and start logging it is as simple.

Just have a look at this for starters on how to use log4j, add this code to the calling method of your managed bean.
lo4j
Let me know if you need to know anything more.
 
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic