You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2022/09/30 21:38:28 UTC

[GitHub] [logging-log4cxx] swebb2066 opened a new pull request, #137: Document DefaultConfigurator actual behaviour

swebb2066 opened a new pull request, #137:
URL: https://github.com/apache/logging-log4cxx/pull/137

   This PR also allows the user to specify of the configuration file and the watch seconds in program code.
   
   This make automatic configuration more useful by allowing the configuration file and watch seconds to be set in a user's getLogger().
   
   For example:
   
   ```
   log4cxx::LoggerPtr MyLogManager::getLogger(const log4cxx::LogString& name)
   {
     static std::once_flag initialize_log4cxx;
     static std::call_once(initialize_log4cxx, myLog4cxxInitializer);
     return log4cxx::getLogger(name);
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4cxx] rm5248 commented on pull request #137: Document DefaultConfigurator actual behaviour

Posted by GitBox <gi...@apache.org>.
rm5248 commented on PR #137:
URL: https://github.com/apache/logging-log4cxx/pull/137#issuecomment-1264340531

   The latest failure on OSX may be a timing issue.  If there's a way to avoid the sleep in the test we should probably do that, otherwise that will likely continue to intermittently fail.
   
   For `DefaultConfigurator::setConfigurationWatchSeconds` should this be `std::chrono` instead of just raw int?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4cxx] swebb2066 commented on pull request #137: Document DefaultConfigurator actual behaviour

Posted by GitBox <gi...@apache.org>.
swebb2066 commented on PR #137:
URL: https://github.com/apache/logging-log4cxx/pull/137#issuecomment-1264540870

   **  If there's a way to avoid the sleep in the test we should probably do that.
   Sleeping longer makes the test more robust by ensuring the creation time and modification time are different.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4cxx] rm5248 commented on a diff in pull request #137: Document DefaultConfigurator actual behaviour

Posted by GitBox <gi...@apache.org>.
rm5248 commented on code in PR #137:
URL: https://github.com/apache/logging-log4cxx/pull/137#discussion_r985090285


##########
src/main/include/log4cxx/defaultconfigurator.h:
##########
@@ -39,19 +35,39 @@ class LOG4CXX_EXPORT DefaultConfigurator
 
 	public:
 		/**
-		Add a ConsoleAppender that uses PatternLayout
-		using the PatternLayout#TTCC_CONVERSION_PATTERN and
-		prints to <code>stdout</code> to the root logger.*/
-		static void configure(log4cxx::spi::LoggerRepositoryPtr repository);
+		Configure \c repository.
+
+		If the configuration file name has not been provided by a call to setConfigurationFileName(),
+		the environment variables 'LOG4CXX_CONFIGURATION' and 'log4j.configuration' are examined.
+
+		If the configuration file name has not been provided by any of the previous approaches
+		the current directory is examined for a file named either
+		"log4cxx.xml", "log4cxx.properties", "log4j.xml" or "log4j.properties".

Review Comment:
   what happens if this fails?  Does it still fall back to the old way of using the `PatternLayout`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4cxx] swebb2066 commented on pull request #137: Document DefaultConfigurator actual behaviour

Posted by GitBox <gi...@apache.org>.
swebb2066 commented on PR #137:
URL: https://github.com/apache/logging-log4cxx/pull/137#issuecomment-1264535307

   ** The latest failure on OSX may be a timing issue.
   
   The file append modification does not seem to change the `mtime` returned by stat.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4cxx] swebb2066 commented on a diff in pull request #137: Document DefaultConfigurator actual behaviour

Posted by GitBox <gi...@apache.org>.
swebb2066 commented on code in PR #137:
URL: https://github.com/apache/logging-log4cxx/pull/137#discussion_r985168526


##########
src/main/include/log4cxx/defaultconfigurator.h:
##########
@@ -39,19 +35,39 @@ class LOG4CXX_EXPORT DefaultConfigurator
 
 	public:
 		/**
-		Add a ConsoleAppender that uses PatternLayout
-		using the PatternLayout#TTCC_CONVERSION_PATTERN and
-		prints to <code>stdout</code> to the root logger.*/
-		static void configure(log4cxx::spi::LoggerRepositoryPtr repository);
+		Configure \c repository.
+
+		If the configuration file name has not been provided by a call to setConfigurationFileName(),
+		the environment variables 'LOG4CXX_CONFIGURATION' and 'log4j.configuration' are examined.
+
+		If the configuration file name has not been provided by any of the previous approaches
+		the current directory is examined for a file named either
+		"log4cxx.xml", "log4cxx.properties", "log4j.xml" or "log4j.properties".

Review Comment:
   The PatternLayout stuff disappeared some time pre git history.
   
   You will see the unhelpful "Please initialize the log4cxx system properly".
   
   It also writes a LogLog::debug message.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4cxx] swebb2066 commented on pull request #137: Document DefaultConfigurator actual behaviour

Posted by GitBox <gi...@apache.org>.
swebb2066 commented on PR #137:
URL: https://github.com/apache/logging-log4cxx/pull/137#issuecomment-1264534889

   * For DefaultConfigurator::setConfigurationWatchSeconds should this be std::chrono instead of just raw int?
   
   The simplicity of a raw int (seconds) appeals to me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4cxx] swebb2066 commented on a diff in pull request #137: Document DefaultConfigurator actual behaviour

Posted by GitBox <gi...@apache.org>.
swebb2066 commented on code in PR #137:
URL: https://github.com/apache/logging-log4cxx/pull/137#discussion_r985168526


##########
src/main/include/log4cxx/defaultconfigurator.h:
##########
@@ -39,19 +35,39 @@ class LOG4CXX_EXPORT DefaultConfigurator
 
 	public:
 		/**
-		Add a ConsoleAppender that uses PatternLayout
-		using the PatternLayout#TTCC_CONVERSION_PATTERN and
-		prints to <code>stdout</code> to the root logger.*/
-		static void configure(log4cxx::spi::LoggerRepositoryPtr repository);
+		Configure \c repository.
+
+		If the configuration file name has not been provided by a call to setConfigurationFileName(),
+		the environment variables 'LOG4CXX_CONFIGURATION' and 'log4j.configuration' are examined.
+
+		If the configuration file name has not been provided by any of the previous approaches
+		the current directory is examined for a file named either
+		"log4cxx.xml", "log4cxx.properties", "log4j.xml" or "log4j.properties".

Review Comment:
   The PatternLayout stuff disappeared some time pre git history.
   
   If it fails, you will see the unhelpful "Please initialize the log4cxx system properly".
   
   It also writes a LogLog::debug message.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4cxx] swebb2066 commented on a diff in pull request #137: Document DefaultConfigurator actual behaviour

Posted by GitBox <gi...@apache.org>.
swebb2066 commented on code in PR #137:
URL: https://github.com/apache/logging-log4cxx/pull/137#discussion_r985168526


##########
src/main/include/log4cxx/defaultconfigurator.h:
##########
@@ -39,19 +35,39 @@ class LOG4CXX_EXPORT DefaultConfigurator
 
 	public:
 		/**
-		Add a ConsoleAppender that uses PatternLayout
-		using the PatternLayout#TTCC_CONVERSION_PATTERN and
-		prints to <code>stdout</code> to the root logger.*/
-		static void configure(log4cxx::spi::LoggerRepositoryPtr repository);
+		Configure \c repository.
+
+		If the configuration file name has not been provided by a call to setConfigurationFileName(),
+		the environment variables 'LOG4CXX_CONFIGURATION' and 'log4j.configuration' are examined.
+
+		If the configuration file name has not been provided by any of the previous approaches
+		the current directory is examined for a file named either
+		"log4cxx.xml", "log4cxx.properties", "log4j.xml" or "log4j.properties".

Review Comment:
   You will see the unhelpful "Please initialize the log4cxx system properly".
   
   It also writes a LogLog::debug message.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4cxx] swebb2066 merged pull request #137: Document DefaultConfigurator actual behaviour

Posted by GitBox <gi...@apache.org>.
swebb2066 merged PR #137:
URL: https://github.com/apache/logging-log4cxx/pull/137


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org