log4cxx: fix missing symbols and add a test
configure needs the locations of apr-config and apu-config thanks to M-Mueller for the test Fixes #6437. Closes #7046. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
parent
f3568b2031
commit
5b89f2b73b
1 changed files with 41 additions and 1 deletions
|
@ -3,6 +3,7 @@ class Log4cxx < Formula
|
|||
homepage "https://logging.apache.org/log4cxx/index.html"
|
||||
url "https://www.apache.org/dyn/closer.cgi?path=logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz"
|
||||
sha256 "0de0396220a9566a580166e66b39674cb40efd2176f52ad2c65486c99c920c8c"
|
||||
revision 1
|
||||
|
||||
bottle do
|
||||
cellar :any
|
||||
|
@ -58,7 +59,46 @@ class Log4cxx < Formula
|
|||
system "./configure", "--disable-debug", "--disable-dependency-tracking",
|
||||
"--prefix=#{prefix}",
|
||||
# Docs won't install on macOS
|
||||
"--disable-doxygen"
|
||||
"--disable-doxygen",
|
||||
"--with-apr=#{Formula["apr"].opt_bin}",
|
||||
"--with-apr-util=#{Formula["apr-util"].opt_bin}"
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.cpp").write <<-EOS.undent
|
||||
#include <log4cxx/logger.h>
|
||||
#include <log4cxx/propertyconfigurator.h>
|
||||
int main() {
|
||||
log4cxx::PropertyConfigurator::configure("log4cxx.config");
|
||||
|
||||
log4cxx::LoggerPtr log = log4cxx::Logger::getLogger("Test");
|
||||
log->setLevel(log4cxx::Level::getInfo());
|
||||
LOG4CXX_ERROR(log, "Foo");
|
||||
|
||||
return 1;
|
||||
}
|
||||
EOS
|
||||
(testpath/"log4cxx.config").write <<-EOS.undent
|
||||
log4j.rootLogger=debug, stdout, R
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Pattern to output the caller's file name and line number.
|
||||
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
|
||||
|
||||
log4j.appender.R=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.R.File=example.log
|
||||
|
||||
log4j.appender.R.MaxFileSize=100KB
|
||||
# Keep one backup file
|
||||
log4j.appender.R.MaxBackupIndex=1
|
||||
|
||||
log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
|
||||
EOS
|
||||
system ENV.cxx, "test.cpp", "-o", "test", "-L#{lib}", "-llog4cxx"
|
||||
assert_match /ERROR.*Foo/, shell_output("./test", 1)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue