log4c 써보신분 계신가요?
글쓴이: antz / 작성시간: 목, 2005/12/01 - 4:41오후
kubuntu 5.10에서 테스트를 해볼려고 하는데요.
log4c-1.0.12 버전을 사용했구요.
gcc는
Quote:
$ gcc --version
gcc (GCC) 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.$ gcc-3.3 --version
gcc-3.3 (GCC) 3.3.6 (Ubuntu 1:3.3.6-8ubuntu1)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
두가지로 컴파일 해봤구요.
실행하면 로그가 출력되지 않고
그냥 끝나버리네요.
log4c_init()에서 에러는 나지 않지만,
".log4crc" XML파일을 파싱하지 못하는것 같습니다.
테스트 성공하신분 계신가요?
문제가 뭘까요?
$ cat .log4crc <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE log4c SYSTEM ""> <log4c> <category name="xxx" appender="stderr" priority="priority" /> <!-- default appenders ===================================== --> <appender name="stdout" layout="basic"/> <appender name="stderr" layout="dated"/> <!-- default layouts ======================================= --> <layout name="basic"/> <layout name="dated"/> </log4c>
$ cat test_log.c #include <stdio.h> #include <log4c.h> int main() { log4c_category_t* cat = NULL; int count = 0; /* Just to demonstrate that formatted output works */ if (log4c_init()) { printf("Log4c initialisation failedn"); return 0; } cat = log4c_category_get("xxx"); log4c_category_fatal(cat, "This is a fatal message - message %d", count++); log4c_category_warn(cat, "This is a warning message -message %d", count); log4c_category_info(cat, "This is an info message"); if (log4c_fini()) { printf("Log4c finish failedn"); return 0; } }
Forums:
댓글 달기