Commit 3a7aadbe authored by thomas.forbriger's avatar thomas.forbriger Committed by Checksum Backup @bromo
Browse files

csbackgen, csbackntfy, csfile: avoid newline in log message

parent 6ee47119
......@@ -40,6 +40,7 @@
# 26/10/2013 V0.8 dry-run flag introduced
# 09/11/2013 V0.8.1 adjusted help text
# 01/08/2019 V0.8.2 (thof): provide additional debug output
# 02/08/2019 V0.8.3 (thof): do not produce multiline log messages
# =============================================================================
......@@ -54,7 +55,7 @@ import csbacklog
import pidlock
import csbackErrorCodes as eCodes
__version__ = "V0.8.1"
__version__ = "V0.8.3"
__subversion__ = "$Id$"
__license__ = "GPLv2+"
__author__ = "Daniel Armbruster"
......@@ -295,7 +296,10 @@ def main(argv=None):
# generate checksumfiles for subdirectories (recursive mode)
# so collect all available subdirectories here (excluding subdirectories)
if not notRecursive:
logger.getLogger().debug("collect subdirectories\n srcpath: %s\n regexes: %s\n followlinks: %s" % (srcpath, regexes, followlinks))
logger.getLogger().debug("collect subdirectories")
logger.getLogger().debug(" srcpath: '%s'" % srcpath)
logger.getLogger().debug(" regexes: '%s'" % regexes)
logger.getLogger().debug(" followlinks: '%s'" % followlinks)
dirs.extend(csfile.getSubDirectories(srcpath, regexes, followlinks))
# if a target directory had been passed extend the list of
# target directories replacing the trunk of the source directory with the
......@@ -276,8 +276,8 @@ def main(argv=None):
timeStamp=dt.datetime.strptime(str(now.year)+" "+" ".join(str(n)
for n in line.split()[0:3]),"%Y %b %d %H:%M:%S")
raise Error(("Error while parsing log line\n %s\n"
+" from file %s") % (line, path),
logger.getLogger().error("Error while parsing log line: '%s'" % line)
raise Error("Error while parsing log line from file %s" % path,
if 'CRITICAL' in line:
if timeStamp > timeLimit:
......@@ -291,10 +291,9 @@ def main(argv=None):
elif 'INFO' in line:
infoDeque.appendleft("logfile: "+path+"\n"+line)
logger.getLogger().info(("Illegal line in logfile found\n"
+" Line does not contain any of the csback message level keywords\n"
+" %s %s %s %s\n The log line is:\n %s")
% ("CRITICAL", "ERROR", "WARNING", "INFO", line))
logger.getLogger().info("Illegal line in logfile found")
logger.getLogger().info(" Line does not contain any of the csback message level keywords")
logger.getLogger().info(" The log line is: '%s'" % line)
except IOError as err:
raise Error("Error while reading logfiles: "+err.filename, \
......@@ -55,6 +55,7 @@
# message, if application of a regex fails
# V0.6.7 (thof) capture problem with whitespace in file names
# which results in not accepted hash types
# 02/08/2019 V0.6.8 (thof) do not write newline to log entries
# =============================================================================
""" CsFile module to handle checksumfiles. """
......@@ -72,7 +73,7 @@ from datetime import date
import csbacklog
import csbackErrorCodes as eCodes
__version__ = "V0.6.7"
__version__ = "V0.6.8"
__subversion__ = "$Id$"
__license__ = "GPLv2+"
__author__ = "Daniel Armbruster"
......@@ -500,11 +501,11 @@ class CsLine:
hashfunc =
raise CsFileError(("When evaluating checksum file entry\n in directory %s\n"
+" hash type '%s' as specified for file '%s' is not accepted\n"
+" consider a problem with whitespace in file names\n"
+" the respective checksum file entry is\n"
+" %s") % (self.srcdir, self.hashfunc, self.filename, self), eCodes.GLOBAL_UnhandledException)
self.logger.error("Start reading checksumfile '%s'",self.filename)
self.logger.error(" Checksum line: '%s'",self)
self.logger.error(" Hash is not accepted: '%s'",self.hasfunc)
raise CsFileError("Abort caused by ill-formatted checksum line '%'"
% self, eCodes.GLOBAL_UnhandledException)
blockSize = chunkSize * hashfunc.block_size
path = os.path.join(self.srcdir, self.filename)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment