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
- 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.
Joined: Jul 25, 2011
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
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
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.