Feature #1814
closed
Prepare script for log rotation of connector server
Added by Roman Kučera over 5 years ago.
Updated about 4 years ago.
Description
This connector should be used in connector server and now it's logging to file but rotating of this file is not solved.
Prepare script for log rotating on Linux environment
You can follow steps in https://wiki.czechidm.com/devel/documentation/adm/systems/winrm_ad_connector?s[]=connector&s[]=server#installation how to download and use connector server.
Typical usage is that we have connector server in /opt/connid-connector-server
Connector logs are now in /opt/connid-connector-server/logs/connectorserver0.log
Config for connector and logging are in /opt/connid-connector-server/conf
The result should be that log will be rotated every day.
Connector server can be run on Linux or Windows
- Related to Task #690: Automatic tomcat log rotation added
- Description updated (diff)
- Description updated (diff)
- Description updated (diff)
- Status changed from New to In Progress
- Assignee set to Luděk Urban
I tried install connector server, but server doesn't log to file. Server not load logback-spring.xml or logback-core.jar.
For next step I will try add connector. Maybe connector server use logback only if there is a connector.
Finally manage to log to file from connector-server. Connector server is using logging.properties like IdM.
I will try rotate logs like in idm on windows - #690.
I tried configure logback but connector-server not even opens logback.xml file.
I also tried configure logging properties but java.util.logging.FileHandler can't rotate log files.
I tried add logger from log4j, sflm4j and logback but all of them don't work with connector server.
Error was:
Caused by: java.lang.InstantiationException: org.apache.logging.log4j.Logger
at java.lang.Class.newInstance(Class.java:427)
at org.identityconnectors.common.logging.Log.getLog(Log.java:147)
... 5 more
Caused by: java.lang.NoSuchMethodException: org.apache.logging.log4j.Logger.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
It's probrably bug in connector server where he use method "getConstructor" which is only in juli logger.
I created a workaround which uses logrotate.
I used default connector server logger class "org.identityconnectors.common.logging.impl.JDKLogger"
Then a change "/opt/connid-connector-server/conf/logging.properties" to log into "logs/connectorserver.log" file in conector server directory:
handlers=java.util.logging.FileHandler
java.util.logging.FileHandler.pattern = logs/connectorserver.log
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.append = true
level=DEBUG
As a final step a configure logrotate to rotate file "/opt/connid-connector-server/logs/connectorserver.log" and keep 14 days of backup.
Configuration /etc/logrotate.d/connector_server
/opt/connid-connector-server/logs/connectorserver.log {
copytruncate
daily
rotate 14
compress
dateext
missingok
create 0644 connector-server connector-server
su connector-server connector-server
}
This workaround works but it would be better to have all configuration inside connector server and not use logrotate.
@urbanl @fiserp Can we close this ticket? As far as I know this should be already implemented and we have it in our wiki guide.
The logrotate solution works but it is a Linux-only. That is why this ticket is probably still open.
We need to rotate logs on Windows too.
status check
I found that logback.xml in our connector and in Original ConID connector differs. Our has commented log rotation setting.
Previously I found that our connector server doesn't load/read logback configuration.
Next step:
- Check again if logback configuration has been loaded or not
- Ckeck if log rotation can be set in logrotate
- Status changed from In Progress to Closed
I checked if we use connector server and I found that we don't use it on Windows.
Because there isn't any working solutions resolution of rotation logs on connector server yet and we don't need it now I will close this ticket.
If we need deploy connector server on windows I open this ticket again.
Also available in: Atom
PDF