If there is a better place to post this, please tell me and I will. But seeing the state of the project, no active maintainer, this seems to be the best I can do.
I need the SimpleConfigurator to be able to handle file names that were quoted so I added the code and here is a patch. It was made on Mac OS X 10.2 using gcc 3.1. It may break everywhere else. It adds dependencies on <sys/param.h> and MAXPATHLEN.
--- log4cpp/src/SimpleConfigurator.cpp Mon Mar 15 12:19:20 2004
+++ /tmp/SimpleConfigurator.cpp Mon Mar 15 12:18:21 2004
@@ -19,7 +19,7 @@
#include <string>
#include <fstream>
#include <stdio.h>
-
+#include <sys/param.h>
#include <log4cpp/Category.hh>
#include <log4cpp/Appender.hh>
#include <log4cpp/OstreamAppender.hh>
@@ -83,6 +83,16 @@
if (!(initFile >> logFileName)) {
throw ConfigureFailure("Missing filename for log file logging configuration file for category: " + categoryName);
}
+ if ( logFileName[0] == '"' )
+ { // most likely does not have full file name
+ char filebuf[MAXPATHLEN];
+
+ if ( !(initFile.get( filebuf, MAXPATHLEN, '"' ))) {
+ throw ConfigureFailure("Missing terminator in filename for log file logging configuration file for category: " + categoryName);
+ }
+ initFile.get(); // remove "
+ logFileName = logFileName.substr( 1, logFileName.size() - 1 ) + filebuf;
+ }
appender = new log4cpp::FileAppender(categoryName, logFileName);
}
else if (appenderName.compare("rolling") == 0) {
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If there is a better place to post this, please tell me and I will. But seeing the state of the project, no active maintainer, this seems to be the best I can do.
I need the SimpleConfigurator to be able to handle file names that were quoted so I added the code and here is a patch. It was made on Mac OS X 10.2 using gcc 3.1. It may break everywhere else. It adds dependencies on <sys/param.h> and MAXPATHLEN.
--- log4cpp/src/SimpleConfigurator.cpp Mon Mar 15 12:19:20 2004
+++ /tmp/SimpleConfigurator.cpp Mon Mar 15 12:18:21 2004
@@ -19,7 +19,7 @@
#include <string>
#include <fstream>
#include <stdio.h>
-
+#include <sys/param.h>
#include <log4cpp/Category.hh>
#include <log4cpp/Appender.hh>
#include <log4cpp/OstreamAppender.hh>
@@ -83,6 +83,16 @@
if (!(initFile >> logFileName)) {
throw ConfigureFailure("Missing filename for log file logging configuration file for category: " + categoryName);
}
+ if ( logFileName[0] == '"' )
+ { // most likely does not have full file name
+ char filebuf[MAXPATHLEN];
+
+ if ( !(initFile.get( filebuf, MAXPATHLEN, '"' ))) {
+ throw ConfigureFailure("Missing terminator in filename for log file logging configuration file for category: " + categoryName);
+ }
+ initFile.get(); // remove "
+ logFileName = logFileName.substr( 1, logFileName.size() - 1 ) + filebuf;
+ }
appender = new log4cpp::FileAppender(categoryName, logFileName);
}
else if (appenderName.compare("rolling") == 0) {