Hello community,
log4j is the de facto standard framework in the Java world for logging.
Here you find the complete manual from Ceki Gülcü. In the following code snippet you find a short implementation for Jabaco. It is a form with two buttons. The first button print out two message to the console, and the second changes the level of the logger. After changing the level, you see only one message in the console, because only the level WARN or higher.
|
Jabaco Source
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
'-Define Logger-------------------------------------------------------
Private logClick As Logger
'-Initialize with Form_Load-------------------------------------------
Private Sub Form_Load()
Set logClick = org#apache#log4j#Logger.getLogger("Form1.Click")
org#apache#log4j#BasicConfigurator.configure()
End Sub
'-1st button clik-----------------------------------------------------
Public Sub Command1_Click()
logClick.info("Hello World")
logClick.warn("Hello World")
End Sub
'-2nd button click----------------------------------------------------
Public Sub Command2_Click()
logClick.setLevel Level.WARN
End Sub
|
I think the using from log4j with Jabaco can be very lucrative, because it is very simply to control logging messages and configure it. Look at the manual to find much more possibilities about the hierarchy of message types, appenders, configurations, filters, etc. etc.
Cheers
Stefan