This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes how to add LOG function in richfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "how to add LOG function in richfaces" Watch "how to add LOG function in richfaces" New topic
Author

how to add LOG function in richfaces

leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
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
H Jetly
Ranch Hand

Joined: Aug 26, 2010
Posts: 41

Use the managed bean, with in use the log4j or even better use sl4j.


Harsh Jetly
leonardo ginting
Ranch Hand

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

Joined: Aug 26, 2010
Posts: 41

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 ?

Tom mmeke
Greenhorn

Joined: Jul 19, 2011
Posts: 10

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

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

Joined: Aug 26, 2010
Posts: 41

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.
 
 
subject: how to add LOG function in richfaces
 
Similar Threads
ADF vs. RichFaces? What Would You Chose?
JTable - How to Delete Data
Backing Bean
log function in jsf
Is it Possible to add Pagination in h:dataTable