33
33
import org .audit4j .core .exception .TroubleshootException ;
34
34
import org .audit4j .core .handler .ConsoleAuditHandler ;
35
35
import org .audit4j .core .handler .Handler ;
36
+ import org .audit4j .core .handler .file .FileAuditHandler ;
36
37
import org .audit4j .core .layout .SimpleLayout ;
37
38
38
39
import com .esotericsoftware .yamlbeans .YamlException ;
@@ -62,19 +63,17 @@ private ConfigUtil() {
62
63
static Configuration createDummyConfig () {
63
64
Configuration conf = new Configuration ();
64
65
List <Handler > handlers = new ArrayList <>();
65
- /*DatabaseAuditHandler handler = new DatabaseAuditHandler();
66
- handler.setEmbedded("true");
67
- handler.setDb_driver("driver");
68
- handler.setDb_url("");
69
- handler.setDb_user("audit4juser");
70
- handler.setDb_password("password");
71
- handlers.add(handler);*/
66
+ FileAuditHandler handler = new FileAuditHandler ();
67
+ handler .setArchive ("true" );
68
+ handler .setCronPattern ("1d1M" );
69
+ handlers .add (handler );
72
70
//FileAuditHandler handler = new FileAuditHandler();
73
71
//handlers.add(handler);
74
72
ConsoleAuditHandler handler2 = new ConsoleAuditHandler ();
75
73
handlers .add (handler2 );
76
74
conf .setHandlers (handlers );
77
75
conf .setLayout (new SimpleLayout ());
76
+ conf .setOptions ("sd" );
78
77
Map <String ,String > properties = new HashMap <String ,String >();
79
78
properties .put ("log.file.location" , "$user.dir" );
80
79
conf .setProperties (properties );
@@ -88,7 +87,7 @@ static Configuration createDummyConfig() {
88
87
static void generateConfigFromObject () {
89
88
YamlWriter writer ;
90
89
try {
91
- writer = new YamlWriter (new FileWriter ("auit4j .conf.yml" ));
90
+ writer = new YamlWriter (new FileWriter ("audit4j .conf.yml" ));
92
91
writer .getConfig ().setClassTag ("Configuration" , Configuration .class );
93
92
writer .write (createDummyConfig ());
94
93
writer .close ();
0 commit comments