Re: [Freeipa-devel] [PATCH 0434] log: add timestamp to filename of logs
On 14.03.2016 14:15, Jan Cholasta wrote: On 14.3.2016 13:56, Rob Crittenden wrote: Jan Cholasta wrote: On 11.3.2016 15:56, Gabe Alford wrote: On Fri, Mar 11, 2016 at 7:35 AM, Petr Vobornik> wrote: On 03/11/2016 03:00 PM, Rob Crittenden wrote: Martin Kosek wrote: On 03/11/2016 09:55 AM, Jan Cholasta wrote: On 11.3.2016 09:33, Martin Kosek wrote: On 03/08/2016 07:07 PM, Martin Basti wrote: On 08.03.2016 16:37, Martin Basti wrote: On 08.03.2016 16:31, Martin Basti wrote: https://fedorahosted.org/freeipa/ticket/4501 Patch attached. Rebased patch attached. self-NACK Scripts print to CLI unformatted strings, it should not be so easy. See /var/log/ipaupgrade-{timestamp}.log for more information second-NACK. We cannot break existing log file paths. The paths are mentioned in a documentation and there may be also automation around that (gathering log files). So there should be always symlink from the well known location to the newest timestampe'd log. Sorry, but this is absurd. What's the point of maintaining backward compatibility with obsolete documentation? Following this logic, we would not be able to change anything ever. What we should actually do is update the documentation. Ditto for automation. +1 for updating the automation and documentation. But some backward compatibility will need to be retained, at least for the stable systems like RHEL where *other* people may have some automation or documentation around it, not just us. Or you could just also create a symlink to the old name and it will always just work. rob Aren't the symlinks what Martin2 mentioned in second-NACK? These new timestamped logs should be combined with the Gabe's patches: #5728 (renamed to command name) and #5724 (move to /var/log/ipa directory). So that there will be e.g.: /var/log/ipaserver-install.log -> /var/log/ipa-server-install-{timestamp}.log /var/log/ipa/ipa-server-install.log -> /var/log/ipa-server-install-{timestamp}.log I wonder if it would be simpler/better to always write to the *.log file, and then have old logs timestamped rather than write directly to a timestamped log file? Then just symlink the original log file in /var/log/ to the new log file name/location in /var/log/ipa. For example: /var/log/ipaserver-install.log -> /var/log/ipa/ipa-server-install.log<-- We write to this log (current) /var/log/ipa-server-install-{timestamp}.log <-- Old log with some date /var/log/ipa-server-install-{timestamp}.log <-- Older log with some date /var/log/ipa-server-install-{timestamp}.log <-- Oldest log with some date This is way too overengineered for something that should actually be really simple. I don't care if it is done this way or not, but IMHO it would be a waste of time. Logs are not API and should not be treated as such. If it needs to be done differently on RHEL, it should be handled downstream. Sure logs are not API but they have been named the same way since inception (nearly 8 years now). I don't think symlinking to the old names is a big deal. It kind of is, since you have to keep the symlink up to date, handle the case when there is a regular file in place of the symlink, and they won't work properly for commands which currently append to their log files rather than overwrite them anyway. To do this properly, you have to add a new FileHandler with proper options for each old log file. IMHO there is no benefit in doing this upstream, but it is relatively straightforward and isolated to be done downstream. PermaNACK, the ticket has been moved to Future Releases -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0434] log: add timestamp to filename of logs
On 14.3.2016 13:56, Rob Crittenden wrote: Jan Cholasta wrote: On 11.3.2016 15:56, Gabe Alford wrote: On Fri, Mar 11, 2016 at 7:35 AM, Petr Vobornik> wrote: On 03/11/2016 03:00 PM, Rob Crittenden wrote: Martin Kosek wrote: On 03/11/2016 09:55 AM, Jan Cholasta wrote: On 11.3.2016 09:33, Martin Kosek wrote: On 03/08/2016 07:07 PM, Martin Basti wrote: On 08.03.2016 16:37, Martin Basti wrote: On 08.03.2016 16:31, Martin Basti wrote: https://fedorahosted.org/freeipa/ticket/4501 Patch attached. Rebased patch attached. self-NACK Scripts print to CLI unformatted strings, it should not be so easy. See /var/log/ipaupgrade-{timestamp}.log for more information second-NACK. We cannot break existing log file paths. The paths are mentioned in a documentation and there may be also automation around that (gathering log files). So there should be always symlink from the well known location to the newest timestampe'd log. Sorry, but this is absurd. What's the point of maintaining backward compatibility with obsolete documentation? Following this logic, we would not be able to change anything ever. What we should actually do is update the documentation. Ditto for automation. +1 for updating the automation and documentation. But some backward compatibility will need to be retained, at least for the stable systems like RHEL where *other* people may have some automation or documentation around it, not just us. Or you could just also create a symlink to the old name and it will always just work. rob Aren't the symlinks what Martin2 mentioned in second-NACK? These new timestamped logs should be combined with the Gabe's patches: #5728 (renamed to command name) and #5724 (move to /var/log/ipa directory). So that there will be e.g.: /var/log/ipaserver-install.log -> /var/log/ipa-server-install-{timestamp}.log /var/log/ipa/ipa-server-install.log -> /var/log/ipa-server-install-{timestamp}.log I wonder if it would be simpler/better to always write to the *.log file, and then have old logs timestamped rather than write directly to a timestamped log file? Then just symlink the original log file in /var/log/ to the new log file name/location in /var/log/ipa. For example: /var/log/ipaserver-install.log -> /var/log/ipa/ipa-server-install.log<-- We write to this log (current) /var/log/ipa-server-install-{timestamp}.log <-- Old log with some date /var/log/ipa-server-install-{timestamp}.log <-- Older log with some date /var/log/ipa-server-install-{timestamp}.log <-- Oldest log with some date This is way too overengineered for something that should actually be really simple. I don't care if it is done this way or not, but IMHO it would be a waste of time. Logs are not API and should not be treated as such. If it needs to be done differently on RHEL, it should be handled downstream. Sure logs are not API but they have been named the same way since inception (nearly 8 years now). I don't think symlinking to the old names is a big deal. It kind of is, since you have to keep the symlink up to date, handle the case when there is a regular file in place of the symlink, and they won't work properly for commands which currently append to their log files rather than overwrite them anyway. To do this properly, you have to add a new FileHandler with proper options for each old log file. IMHO there is no benefit in doing this upstream, but it is relatively straightforward and isolated to be done downstream. -- Jan Cholasta -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0434] log: add timestamp to filename of logs
On 11.3.2016 15:56, Gabe Alford wrote: On Fri, Mar 11, 2016 at 7:35 AM, Petr Vobornik> wrote: On 03/11/2016 03:00 PM, Rob Crittenden wrote: Martin Kosek wrote: On 03/11/2016 09:55 AM, Jan Cholasta wrote: On 11.3.2016 09:33, Martin Kosek wrote: On 03/08/2016 07:07 PM, Martin Basti wrote: On 08.03.2016 16:37, Martin Basti wrote: On 08.03.2016 16:31, Martin Basti wrote: https://fedorahosted.org/freeipa/ticket/4501 Patch attached. Rebased patch attached. self-NACK Scripts print to CLI unformatted strings, it should not be so easy. See /var/log/ipaupgrade-{timestamp}.log for more information second-NACK. We cannot break existing log file paths. The paths are mentioned in a documentation and there may be also automation around that (gathering log files). So there should be always symlink from the well known location to the newest timestampe'd log. Sorry, but this is absurd. What's the point of maintaining backward compatibility with obsolete documentation? Following this logic, we would not be able to change anything ever. What we should actually do is update the documentation. Ditto for automation. +1 for updating the automation and documentation. But some backward compatibility will need to be retained, at least for the stable systems like RHEL where *other* people may have some automation or documentation around it, not just us. Or you could just also create a symlink to the old name and it will always just work. rob Aren't the symlinks what Martin2 mentioned in second-NACK? These new timestamped logs should be combined with the Gabe's patches: #5728 (renamed to command name) and #5724 (move to /var/log/ipa directory). So that there will be e.g.: /var/log/ipaserver-install.log -> /var/log/ipa-server-install-{timestamp}.log /var/log/ipa/ipa-server-install.log -> /var/log/ipa-server-install-{timestamp}.log I wonder if it would be simpler/better to always write to the *.log file, and then have old logs timestamped rather than write directly to a timestamped log file? Then just symlink the original log file in /var/log/ to the new log file name/location in /var/log/ipa. For example: /var/log/ipaserver-install.log -> /var/log/ipa/ipa-server-install.log<-- We write to this log (current) /var/log/ipa-server-install-{timestamp}.log <-- Old log with some date /var/log/ipa-server-install-{timestamp}.log <-- Older log with some date /var/log/ipa-server-install-{timestamp}.log <-- Oldest log with some date This is way too overengineered for something that should actually be really simple. I don't care if it is done this way or not, but IMHO it would be a waste of time. Logs are not API and should not be treated as such. If it needs to be done differently on RHEL, it should be handled downstream. -- Jan Cholasta -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0434] log: add timestamp to filename of logs
Martin Kosek wrote: > On 03/11/2016 09:55 AM, Jan Cholasta wrote: >> On 11.3.2016 09:33, Martin Kosek wrote: >>> On 03/08/2016 07:07 PM, Martin Basti wrote: On 08.03.2016 16:37, Martin Basti wrote: > > > On 08.03.2016 16:31, Martin Basti wrote: >> https://fedorahosted.org/freeipa/ticket/4501 >> >> Patch attached. >> >> > Rebased patch attached. > > self-NACK Scripts print to CLI unformatted strings, it should not be so easy. See /var/log/ipaupgrade-{timestamp}.log for more information >>> >>> second-NACK. We cannot break existing log file paths. The paths are >>> mentioned >>> in a documentation and there may be also automation around that (gathering >>> log >>> files). So there should be always symlink from the well known location to >>> the >>> newest timestampe'd log. >> >> Sorry, but this is absurd. What's the point of maintaining backward >> compatibility with obsolete documentation? Following this logic, we would not >> be able to change anything ever. What we should actually do is update the >> documentation. Ditto for automation. > > +1 for updating the automation and documentation. But some backward > compatibility will need to be retained, at least for the stable systems like > RHEL where *other* people may have some automation or documentation around it, > not just us. > Or you could just also create a symlink to the old name and it will always just work. rob -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0434] log: add timestamp to filename of logs
On 03/11/2016 09:55 AM, Jan Cholasta wrote: > On 11.3.2016 09:33, Martin Kosek wrote: >> On 03/08/2016 07:07 PM, Martin Basti wrote: >>> >>> >>> On 08.03.2016 16:37, Martin Basti wrote: On 08.03.2016 16:31, Martin Basti wrote: > https://fedorahosted.org/freeipa/ticket/4501 > > Patch attached. > > Rebased patch attached. >>> >>> self-NACK >>> >>> Scripts print to CLI unformatted strings, it should not be so easy. >>> See /var/log/ipaupgrade-{timestamp}.log for more information >> >> second-NACK. We cannot break existing log file paths. The paths are mentioned >> in a documentation and there may be also automation around that (gathering >> log >> files). So there should be always symlink from the well known location to the >> newest timestampe'd log. > > Sorry, but this is absurd. What's the point of maintaining backward > compatibility with obsolete documentation? Following this logic, we would not > be able to change anything ever. What we should actually do is update the > documentation. Ditto for automation. +1 for updating the automation and documentation. But some backward compatibility will need to be retained, at least for the stable systems like RHEL where *other* people may have some automation or documentation around it, not just us. -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0434] log: add timestamp to filename of logs
On 11.3.2016 09:33, Martin Kosek wrote: On 03/08/2016 07:07 PM, Martin Basti wrote: On 08.03.2016 16:37, Martin Basti wrote: On 08.03.2016 16:31, Martin Basti wrote: https://fedorahosted.org/freeipa/ticket/4501 Patch attached. Rebased patch attached. self-NACK Scripts print to CLI unformatted strings, it should not be so easy. See /var/log/ipaupgrade-{timestamp}.log for more information second-NACK. We cannot break existing log file paths. The paths are mentioned in a documentation and there may be also automation around that (gathering log files). So there should be always symlink from the well known location to the newest timestampe'd log. Sorry, but this is absurd. What's the point of maintaining backward compatibility with obsolete documentation? Following this logic, we would not be able to change anything ever. What we should actually do is update the documentation. Ditto for automation. -- Jan Cholasta -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0434] log: add timestamp to filename of logs
On 03/08/2016 07:07 PM, Martin Basti wrote: > > > On 08.03.2016 16:37, Martin Basti wrote: >> >> >> On 08.03.2016 16:31, Martin Basti wrote: >>> https://fedorahosted.org/freeipa/ticket/4501 >>> >>> Patch attached. >>> >>> >> Rebased patch attached. >> >> > > self-NACK > > Scripts print to CLI unformatted strings, it should not be so easy. > See /var/log/ipaupgrade-{timestamp}.log for more information second-NACK. We cannot break existing log file paths. The paths are mentioned in a documentation and there may be also automation around that (gathering log files). So there should be always symlink from the well known location to the newest timestampe'd log. -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0434] log: add timestamp to filename of logs
On 08.03.2016 16:37, Martin Basti wrote: On 08.03.2016 16:31, Martin Basti wrote: https://fedorahosted.org/freeipa/ticket/4501 Patch attached. Rebased patch attached. self-NACK Scripts print to CLI unformatted strings, it should not be so easy. See /var/log/ipaupgrade-{timestamp}.log for more information -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0434] log: add timestamp to filename of logs
On 08.03.2016 16:31, Martin Basti wrote: https://fedorahosted.org/freeipa/ticket/4501 Patch attached. Rebased patch attached. From 6539b6e438a391c24ed5b4f920ff825973537b0f Mon Sep 17 00:00:00 2001 From: Martin BastiDate: Fri, 4 Mar 2016 16:57:20 +0100 Subject: [PATCH] logging: add timestamps to log filenames Originally installation logs were overwritten or new entries were appended. Now logs are created with timestamp in filename, so it clear what happens when, logs are not overwritten anymore. https://fedorahosted.org/freeipa/ticket/4501 --- ipaplatform/base/paths.py| 27 +++ ipapython/ipa_log_manager.py | 8 ipatests/test_integration/tasks.py | 16 ipatests/test_integration/test_caless.py | 8 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py index bdff4f3934f3250bdfef3f913631b98d55d759b6..d7a9219a098896b88f42d3a3680b4e39c389aabc 100644 --- a/ipaplatform/base/paths.py +++ b/ipaplatform/base/paths.py @@ -295,18 +295,21 @@ class BasePathNamespace(object): SLAPD_INSTANCE_ERROR_LOG_TEMPLATE = "/var/log/dirsrv/slapd-%s/errors" VAR_LOG_HTTPD_DIR = "/var/log/httpd" IPABACKUP_LOG = "/var/log/ipabackup.log" -IPACLIENT_INSTALL_LOG = "/var/log/ipaclient-install.log" -IPACLIENT_UNINSTALL_LOG = "/var/log/ipaclient-uninstall.log" -IPAREPLICA_CA_INSTALL_LOG = "/var/log/ipareplica-ca-install.log" -IPAREPLICA_CONNCHECK_LOG = "/var/log/ipareplica-conncheck.log" -IPAREPLICA_INSTALL_LOG = "/var/log/ipareplica-install.log" -IPARESTORE_LOG = "/var/log/iparestore.log" -IPASERVER_CA_INSTALL_LOG = "/var/log/ipaserver-ca-install.log" -IPASERVER_INSTALL_LOG = "/var/log/ipaserver-install.log" -IPASERVER_KRA_INSTALL_LOG = "/var/log/ipaserver-kra-install.log" -IPASERVER_KRA_UNINSTALL_LOG = "/var/log/ipaserver-kra-uninstall.log" -IPASERVER_UNINSTALL_LOG = "/var/log/ipaserver-uninstall.log" -IPAUPGRADE_LOG = "/var/log/ipaupgrade.log" +IPACLIENT_INSTALL_LOG = "/var/log/ipaclient-install-{timestamp}.log" +IPACLIENT_UNINSTALL_LOG = "/var/log/ipaclient-uninstall-{timestamp}.log" +IPAREPLICA_CA_INSTALL_LOG = ( +"/var/log/ipareplica-ca-install-{timestamp}.log") +IPAREPLICA_CONNCHECK_LOG = "/var/log/ipareplica-conncheck-{timestamp}.log" +IPAREPLICA_INSTALL_LOG = "/var/log/ipareplica-install-{timestamp}.log" +IPARESTORE_LOG = "/var/log/iparestore-{timestamp}.log" +IPASERVER_CA_INSTALL_LOG = "/var/log/ipaserver-ca-install-{timestamp}.log" +IPASERVER_INSTALL_LOG = "/var/log/ipaserver-install-{timestamp}.log" +IPASERVER_KRA_INSTALL_LOG = ( +"/var/log/ipaserver-kra-install-{timestamp}.log") +IPASERVER_KRA_UNINSTALL_LOG = ( +"/var/log/ipaserver-kra-uninstall-{timestamp}.log") +IPASERVER_UNINSTALL_LOG = "/var/log/ipaserver-uninstall-{timestamp}.log" +IPAUPGRADE_LOG = "/var/log/ipaupgrade-{timestamp}.log" KADMIND_LOG = "/var/log/kadmind.log" MESSAGES = "/var/log/messages" VAR_LOG_PKI_DIR = "/var/log/pki/" diff --git a/ipapython/ipa_log_manager.py b/ipapython/ipa_log_manager.py index 8a555ebda7919214c20d40ec45b9b5f7863f0298..c36265436b88a22786d0cb4ae8fb673c5be3a116 100644 --- a/ipapython/ipa_log_manager.py +++ b/ipapython/ipa_log_manager.py @@ -29,6 +29,8 @@ import sys import re import copy +from datetime import datetime + from ipapython.log_manager import LogManager, parse_log_level #--- @@ -62,6 +64,8 @@ LOGGING_FORMAT_STANDARD_CONSOLE = '%(name)-12s: %(levelname)-8s %(message)s' # Used by standard_logging_setup() for file message LOGGING_FORMAT_STANDARD_FILE = '%(asctime)s %(levelname)s %(message)s' +FILENAME_TIMESTAMP_FORMAT = '%Y%m%d%H%M' + #--- class IPALogManager(LogManager): @@ -175,6 +179,10 @@ def standard_logging_setup(filename=None, verbose=False, debug=False, filemode='w', console_format=LOGGING_FORMAT_STANDARD_CONSOLE): handlers = [] +if filename: +filename = filename.format( +timestamp=datetime.now().strftime(FILENAME_TIMESTAMP_FORMAT)) + # File output is always logged at debug level if filename is not None: file_handler = dict(name='file', diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py index cb9620133263eb4ed67cbb982080327898cadcef..995f6a17b551b5c0f3cd04986b5a35a49e47aa5b 100644 --- a/ipatests/test_integration/tasks.py +++ b/ipatests/test_integration/tasks.py @@ -225,8 +225,8 @@ def enable_replication_debugging(host): def install_master(host, setup_dns=True, setup_kra=False, extra_args=()): -host.collect_log(paths.IPASERVER_INSTALL_LOG) -host.collect_log(paths.IPACLIENT_INSTALL_LOG) +
[Freeipa-devel] [PATCH 0434] log: add timestamp to filename of logs
https://fedorahosted.org/freeipa/ticket/4501 Patch attached. From ca3a3bd01e6990a42e2d7c809b1f698da53b04a4 Mon Sep 17 00:00:00 2001 From: Martin BastiDate: Fri, 4 Mar 2016 16:57:20 +0100 Subject: [PATCH] logging: add timestamps to log filenames Originally installation logs were overwritten or new entries were appended. Now logs are created with timestamp in filename, so it clear what happens when, logs are not overwritten anymore. https://fedorahosted.org/freeipa/ticket/4501 --- ipaplatform/base/paths.py| 27 +++ ipapython/ipa_log_manager.py | 8 ipatests/test_integration/tasks.py | 16 ipatests/test_integration/test_caless.py | 8 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py index bdff4f3934f3250bdfef3f913631b98d55d759b6..d7a9219a098896b88f42d3a3680b4e39c389aabc 100644 --- a/ipaplatform/base/paths.py +++ b/ipaplatform/base/paths.py @@ -295,18 +295,21 @@ class BasePathNamespace(object): SLAPD_INSTANCE_ERROR_LOG_TEMPLATE = "/var/log/dirsrv/slapd-%s/errors" VAR_LOG_HTTPD_DIR = "/var/log/httpd" IPABACKUP_LOG = "/var/log/ipabackup.log" -IPACLIENT_INSTALL_LOG = "/var/log/ipaclient-install.log" -IPACLIENT_UNINSTALL_LOG = "/var/log/ipaclient-uninstall.log" -IPAREPLICA_CA_INSTALL_LOG = "/var/log/ipareplica-ca-install.log" -IPAREPLICA_CONNCHECK_LOG = "/var/log/ipareplica-conncheck.log" -IPAREPLICA_INSTALL_LOG = "/var/log/ipareplica-install.log" -IPARESTORE_LOG = "/var/log/iparestore.log" -IPASERVER_CA_INSTALL_LOG = "/var/log/ipaserver-ca-install.log" -IPASERVER_INSTALL_LOG = "/var/log/ipaserver-install.log" -IPASERVER_KRA_INSTALL_LOG = "/var/log/ipaserver-kra-install.log" -IPASERVER_KRA_UNINSTALL_LOG = "/var/log/ipaserver-kra-uninstall.log" -IPASERVER_UNINSTALL_LOG = "/var/log/ipaserver-uninstall.log" -IPAUPGRADE_LOG = "/var/log/ipaupgrade.log" +IPACLIENT_INSTALL_LOG = "/var/log/ipaclient-install-{timestamp}.log" +IPACLIENT_UNINSTALL_LOG = "/var/log/ipaclient-uninstall-{timestamp}.log" +IPAREPLICA_CA_INSTALL_LOG = ( +"/var/log/ipareplica-ca-install-{timestamp}.log") +IPAREPLICA_CONNCHECK_LOG = "/var/log/ipareplica-conncheck-{timestamp}.log" +IPAREPLICA_INSTALL_LOG = "/var/log/ipareplica-install-{timestamp}.log" +IPARESTORE_LOG = "/var/log/iparestore-{timestamp}.log" +IPASERVER_CA_INSTALL_LOG = "/var/log/ipaserver-ca-install-{timestamp}.log" +IPASERVER_INSTALL_LOG = "/var/log/ipaserver-install-{timestamp}.log" +IPASERVER_KRA_INSTALL_LOG = ( +"/var/log/ipaserver-kra-install-{timestamp}.log") +IPASERVER_KRA_UNINSTALL_LOG = ( +"/var/log/ipaserver-kra-uninstall-{timestamp}.log") +IPASERVER_UNINSTALL_LOG = "/var/log/ipaserver-uninstall-{timestamp}.log" +IPAUPGRADE_LOG = "/var/log/ipaupgrade-{timestamp}.log" KADMIND_LOG = "/var/log/kadmind.log" MESSAGES = "/var/log/messages" VAR_LOG_PKI_DIR = "/var/log/pki/" diff --git a/ipapython/ipa_log_manager.py b/ipapython/ipa_log_manager.py index 8a555ebda7919214c20d40ec45b9b5f7863f0298..c36265436b88a22786d0cb4ae8fb673c5be3a116 100644 --- a/ipapython/ipa_log_manager.py +++ b/ipapython/ipa_log_manager.py @@ -29,6 +29,8 @@ import sys import re import copy +from datetime import datetime + from ipapython.log_manager import LogManager, parse_log_level #--- @@ -62,6 +64,8 @@ LOGGING_FORMAT_STANDARD_CONSOLE = '%(name)-12s: %(levelname)-8s %(message)s' # Used by standard_logging_setup() for file message LOGGING_FORMAT_STANDARD_FILE = '%(asctime)s %(levelname)s %(message)s' +FILENAME_TIMESTAMP_FORMAT = '%Y%m%d%H%M' + #--- class IPALogManager(LogManager): @@ -175,6 +179,10 @@ def standard_logging_setup(filename=None, verbose=False, debug=False, filemode='w', console_format=LOGGING_FORMAT_STANDARD_CONSOLE): handlers = [] +if filename: +filename = filename.format( +timestamp=datetime.now().strftime(FILENAME_TIMESTAMP_FORMAT)) + # File output is always logged at debug level if filename is not None: file_handler = dict(name='file', diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py index ad2eab218272cc19d208b788d518910821ce5a8a..ead038c8891e23bc8ce98a4447404ca27fef64a4 100644 --- a/ipatests/test_integration/tasks.py +++ b/ipatests/test_integration/tasks.py @@ -225,8 +225,8 @@ def enable_replication_debugging(host): def install_master(host, setup_dns=True, setup_kra=False): -host.collect_log(paths.IPASERVER_INSTALL_LOG) -host.collect_log(paths.IPACLIENT_INSTALL_LOG) +host.collect_log(paths.IPASERVER_INSTALL_LOG.format(timestamp='*')) +