Feature #1814
closedPrepare script for log rotation of connector server
0%
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 issues
Updated by Radek Tomiška over 5 years ago
- Related to Task #690: Automatic tomcat log rotation added
Updated by Luděk Urban over 5 years ago
- 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.
Updated by Luděk Urban over 5 years ago
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.
Updated by Luděk Urban over 5 years ago
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.
Updated by Luděk Urban about 5 years ago
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.
Updated by Luděk Urban about 5 years ago
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.
Updated by Petr Fišer almost 5 years ago
Added chapter to official installation guide on the wiki. Only the logrotate configuration is needed, works with default JDKLogger.
https://wiki.czechidm.com/devel/documentation/adm/systems/connectors/remote_server
Updated by Roman Kučera over 4 years ago
@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.
Updated by Petr Fišer over 4 years ago
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.
Updated by Luděk Urban over 4 years ago
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.
- Check again if logback configuration has been loaded or not
- Ckeck if log rotation can be set in logrotate
Updated by Luděk Urban about 4 years ago
- 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.