is there way to add variables from code to appender?
e.g. <param name="sql" value="INSERT INTO logs(name,log,log_lvl,log_date) VALUES(" + myClass.getUser().getName() +",'%m','%p','%d')"/>
Asked
Active
Viewed 380 times
1

kqlqk
- 53
- 6
-
Your configuration snippet comes from a Log4j 1.x XML configuration. Are you using Log4j 1.x or Log4j 2.x? – Piotr P. Karwasz Feb 27 '22 at 20:38
1 Answers
0
I think you are trying to configure Log4j2 with Java code. Check out Programmatic Configuration. It also covers configuring appenders, which is the level at which you can define the appender's sql parameter if you so wish.

Queeg
- 7,748
- 1
- 16
- 42