Curt Arnold | 1 Mar 2008 15:03
Picon
Favicon

Re: Appender filtering


On Feb 29, 2008, at 5:10 PM, Jacob L. Anawalt wrote:

> Jacob L. Anawalt wrote:
>> I am getting info and debug messages in my system logs.
>
> I have purchased the log4j manual and it looks like I have the  
> appender threshold settings correct.
>
> Here is the output of the attached program and configuration file.
>

..
> log4j.appender.CONSOLE.Threshold=WARN;
>
> log4j.rootLogger=ALL, CONSOLE
>

I think the trailing semi-colon after WARN is messing you up.  If it  
can't find a level with the specified name (in this case "WARN;"), it  
will default to "DEBUG".

Kiyoshi Mizumaru | 2 Mar 2008 12:59
Picon

SIGSEGV on ~RollingFileAppender

Hi

A program linked with log4cxx caught signal 11.
It uses some RollingFileAppender object, instanciated via
PropertyConfigurator::configure and I believe problem occurs
while exiting the program (I found the last line in main()
function executed correctly, by using gdb).

Could anyone please let me know how to solve the problem or
any workaround?  My log4cxx is built from
http://svn.apache.org/repos/asf/logging/log4cxx/trunk,
Revision: 632740.

Thanks in advance,
Kiyoshi

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182908034112 (LWP 14481)]
apr_pool_create_ex (newpool=0x7fbffff340, parent=0x516288, abort_fn=0,
allocator=0x512170) at memory/unix/apr_pools.c:249
249	            if ((*ref = node->next) == NULL && i >= max_index) {
Current language:  auto; currently c
(gdb) bt
#0  apr_pool_create_ex (newpool=0x7fbffff340, parent=0x516288,
abort_fn=0, allocator=0x512170) at memory/unix/apr_pools.c:249
#1  0x0000002a956a5fe0 in log4cxx::helpers::Pool::Pool () at
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_iterator.h:759
#2  0x0000002a95656bbc in log4cxx::helpers::IOException::formatMessage
(stat=9) at exception.cpp:139
#3  0x0000002a95658103 in IOException (this=0x533aa0, stat=Variable
(Continue reading)

Ufuk Kayserilioglu | 4 Mar 2008 20:41

NDC::clone and NDC::inherit

Whatever happened to the NDC functionality of "clone" and "inherit"? I would like to pass around a diagnostic context but the application I am working on is massively multi-threaded and most runs go through various worker-pool threads. Given the functionality of "clone" and "inherit", I was used to cloning the current threads NDC before I post a work-item, posting that along with the work-item, and when the worker-thread received the work-item I would "clear" and "inherit" the NDC for the recepient thread. That way I could always trace a single item throughout all my logs.

Is there a specific reason for the removal of this functionalty? And, is it non-trivial to re-implement it?

Regards,

Ufuk Kayserilioglu
Kiyoshi Mizumaru | 4 Mar 2008 20:57
Picon

Re: SIGSEGV on ~RollingFileAppender

I'm trying to narrowing down my problem and find that the following code
crashes with signal 11, but eliminating the `//' on the sixth line make it run
without any problem.  Could anyone please give me a clue?

--kiyoshi

#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
#include <log4cxx/propertyconfigurator.h>
#include <iostream>

// static log4cxx::LoggerPtr s_message = log4cxx::Logger::getLogger("root");

class baz {
public:
    ~baz() {
        std::cout << "baz::~baz()" << std::endl;
        LOG4CXX_FATAL(log4cxx::Logger::getLogger("root"), "~baz()");
    }
} s_baz;

int main(int, char**) {
    log4cxx::BasicConfigurator::configure();
    return EXIT_SUCCESS;
}

On Sun, Mar 2, 2008 at 8:59 PM, Kiyoshi Mizumaru
<kiyoshi.mizumaru <at> gmail.com> wrote:
> Hi
>
>  A program linked with log4cxx caught signal 11.
>  It uses some RollingFileAppender object, instanciated via
>  PropertyConfigurator::configure and I believe problem occurs
>  while exiting the program (I found the last line in main()
>  function executed correctly, by using gdb).
>
>  Could anyone please let me know how to solve the problem or
>  any workaround?  My log4cxx is built from
>  http://svn.apache.org/repos/asf/logging/log4cxx/trunk,
>  Revision: 632740.
>
>  Thanks in advance,
>  Kiyoshi
>
>
>  Program received signal SIGSEGV, Segmentation fault.
>  [Switching to Thread 182908034112 (LWP 14481)]
>  apr_pool_create_ex (newpool=0x7fbffff340, parent=0x516288, abort_fn=0,
>  allocator=0x512170) at memory/unix/apr_pools.c:249
>  249                 if ((*ref = node->next) == NULL && i >= max_index) {
>  Current language:  auto; currently c
>  (gdb) bt
>  #0  apr_pool_create_ex (newpool=0x7fbffff340, parent=0x516288,
>  abort_fn=0, allocator=0x512170) at memory/unix/apr_pools.c:249
>  #1  0x0000002a956a5fe0 in log4cxx::helpers::Pool::Pool () at
>  /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_iterator.h:759
>  #2  0x0000002a95656bbc in log4cxx::helpers::IOException::formatMessage
>  (stat=9) at exception.cpp:139
>  #3  0x0000002a95658103 in IOException (this=0x533aa0, stat=Variable
>  "stat" is not available.
>  ) at exception.cpp:120
>  #4  0x0000002a956604df in log4cxx::helpers::FileOutputStream::close
>  (this=0x522030) at fileoutputstream.cpp:71
>  #5  0x0000002a956b519e in
>  log4cxx::rolling::CountingOutputStream::close (this=0x52ab60,
>  p=Variable "p" is not available.
>  ) at ../../../src/main/include/log4cxx/helpers/objectptr.h:157
>  #6  0x0000002a956e110f in log4cxx::WriterAppender::closeWriter
>  (this=0x5229e0) at
>  ../../../src/main/include/log4cxx/helpers/objectptr.h:157
>  #7  0x0000002a956e1222 in log4cxx::WriterAppender::close
>  (this=0x5229e0) at writerappender.cpp:143
>  #8  0x0000002a9565c403 in ~FileAppender (this=0x5229e0,
>  __vtt_parm=0x2a958448f0) at fileappender.cpp:88
>  #9  0x0000002a95641316 in ~RollingFileAppenderSkeleton (this=0x5229e0,
>  __vtt_parm=0x2a958448e8) at
>  ../../../src/main/include/log4cxx/helpers/objectptr.h:100
>  #10 0x0000002a95696784 in ~RollingFileAppender (this=0x5229e0) at
>  obsoleterollingfileappender.cpp:87
>  #11 0x0000002a9562b84a in ~ObjectPtrT (this=0x5329f0) at
>  ../../../src/main/include/log4cxx/helpers/objectptr.h:100
>  #12 0x0000002a9562c38e in ~AppenderAttachableImpl (this=0x5220c0) at
>  /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_construct.h:107
>  #13 0x0000002a9568055c in ~Logger (this=0x51a330, __vtt_parm=Variable
>  "__vtt_parm" is not available.
>  ) at ../../../src/main/include/log4cxx/helpers/objectptr.h:100
>  #14 0x0000002a956b8634 in ~RootLogger (this=0x51a330) at rootlogger.cpp:48
>  #15 0x0000002a95bf5e43 in __tcf_0 () at
>  /Proj/07057/tools/include/log4cxx/helpers/objectptr.h:100
>  #16 0x000000388c830f2b in __cxa_finalize () from /lib64/tls/libc.so.6
>  #17 0x0000002a95bc1073 in __do_global_dtors_aux () from
>  /home/maru/branch-log4cxx/monaco/test/stage/lib/libMonacoCommon.so.0
>  #18 0x0000007fbffff730 in ?? ()
>  #19 0x0000002a95bfc601 in _fini () from
>  /home/maru/branch-log4cxx/monaco/test/stage/lib/libMonacoCommon.so.0
>  #20 0x0000000000000013 in ?? ()
>  #21 0x000000388c60b29b in _dl_fini () from /lib64/ld-linux-x86-64.so.2
>  Previous frame inner to this frame (corrupt stack?)
>  (gdb)
>

Jacob L. Anawalt | 4 Mar 2008 23:02

Re: Appender filtering

Curt Arnold wrote:
> I think the trailing semi-colon after WARN is messing you up.

Thank you for pointing that out. I will watch for that in the future. 
Unfortunately it turned out to be more than this. The full app I am testing did 
not have the semi-colon and neither did the XML config I tried.

I tracked it down to fileappender.cpp:166 in the Debian package liblog4cxx9c2a 
(log4cxx version 0.9.7-6). WriteAppender::setOption was being passed the wrong 
variable (name instead of option). It looks like this is already fixed in the 
development version. I then found an email thread [1] mentioning a similar bug 
report [2].

I'm going to give the LevelRangeFilter object a go via filter statements in an 
XML config.

[1] http://marc.info/?l=log4cxx-user&m=119533748424148&w=2
[2] https://issues.apache.org/jira/browse/LOGCXX-207

--

-- 
Jacob Anawalt
Gecko Software, Inc.
janawalt <at> geckosoftware.com
435-752-8026

Jacob L. Anawalt | 5 Mar 2008 00:09

Re: Appender filtering

Jacob L. Anawalt wrote:
> I'm going to give the LevelRangeFilter object a go via filter statements 
> in an XML config.

This appears to be a very workable solution for my needs. I expect that the 
Threshold option to an Appender is slightly more efficient, but I am not worried 
about it.

Thank you for the your work. I look forward to 0.10 in a future release of Debian.
--

-- 
Jacob Anawalt
Gecko Software, Inc.
janawalt <at> geckosoftware.com
435-752-8026

Jewgeni Chygyrynsky | 5 Mar 2008 14:50
Picon
Favicon

How can I build a static library on Windows using ant or msvc?

How can I build a static library on Windows using ant
or msvc? Thanks.

      Lesen Sie Ihre E-Mails jetzt einfach von unterwegs.
www.yahoo.de/go

Jewgeni Chygyrynsky | 5 Mar 2008 17:52
Picon
Favicon

RE: How can I build a static library on Windows using ant or msvc?

Found, works well.

      E-Mails jetzt auf Ihrem Handy.
www.yahoo.de/go

Dale King | 6 Mar 2008 23:27
Picon

2 issues found with 0.10.0-RC2

I built using visual studio and ran into a couple of problems to report.

OdbcAppender  has unicode issues. There are 3 calls to SQL
(SQLExecDirect, SQLDiagRec, and SQLDriverConnect) where the paramters
are based on SQLCHAR. This doesn't work when building for Unicode as
these functions really call the wide character version. Thes calls
should have an A appended to the name to call the non unicode version.
In reality this file should probably be made to work either way.

I used a properties file and configured a ConsoleAppender but did not
set the layout for it. Instead of nicely handling it, it crashed the
application. Probably should fail more gracefully.

--

-- 
Dale King

Dale King | 6 Mar 2008 23:33
Picon

Specify watchdog from config file

I realize this is probably dictated by maintaining compatibility with
Log4J, but thought I would mention. The feature where you can
configure using properties file or XML file and it creates a watchdog
that reconfigures on the fly when the file changes is great. The
problem is that the only way to get that behavior is to modify your
code to make it call configureAndWatch. So you cannot get this
behavior when using the default mechanism to get the configuration
file. You really should be able to specify this within the
configuration file itself.

--

-- 
Dale King


Gmane