Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Blue Logger
05-10-2016, 03:51 PM (This post was last modified: 12-07-2017 06:08 PM by lingu.)
Post: #1
Blue Logger
BlueLogger is available at cod://bluelogger

It provides a set of helper functions for file-based logging.

Currently, C++ programs can use this facility.

Usage
Blue Logger is implemented as a library working with the netcomm and io libraries. All these libraries have binary forms provided by cod://utilib and the binary forms reside in $GROUND_DIR/util/utilib in the code forest.

Consequently, a typical compiling command line includes libraries in cod://utilib, libcomm.a, libio.a and liblogger.a, and cod://dt, libbigmsg.a, to build the Blue Logger. Usually, CXXLINKOPT in cod://utilib/makehead.inc adds the path to utilib and think to the link search path list. It is thus recommended that a makefile building blue logger include cod://utilib/makehead.inc It is also worth noting that in some linking systems, the order of libraries matter -- the linker searches unresovled symbols in the ensuing lib files. Most of the programs use some logging functions. So usually -llogger should be the last, but blue_logger also uses some classes in Filer, etc. If Filer is not used in files before -llogger, the linker may report some unresolved references. I fixed this by placing -lio after -llogger again. The following code shows a possible paradigm in a makefile.

Code:
include /thinker/local/forest/util/utilib/makehead.inc

g++ $(CXXLINKOPT) -lio -llogger -lcomm -lio -lbigmsg -o prog prog.cc

Function declarations are in cod://utilib/blue_logger.h which also introduces how to program using Blue Logger.

----
20171207/gl: Add more info about libs.
Find all posts by this user
Quote this message in a reply
12-07-2017, 06:05 PM
Post: #2
RE: Blue Logger
(05-10-2016 03:51 PM)lingu Wrote:  
Code:
-L<path to utilib> -llogger -lcomm -lio

Usually, CXXLINKOPT in cod://utilib/makehead.inc adds the path to utilib to the link search path list. It is thus recommended that a makefile building blue logger include cod://utilib/makehead.inc It is also worth noting that in some linking systems, the order of libraries matter -- the linker searches unresovled symbols in the ensuing lib files. Most of the programs use some logging functions. So usually -llogger should be the last, but blue_logger also uses some classes in Filer, etc. If Filer is not used in files before -llogger, the linker may report some unresolved references. I fixed this by placing -lio after -llogger again. The following code shows a possible paradigm in a makefile.

Code:
include /thinker/local/forest/util/utilib/makehead.inc

g++ $(CXXLINKOPT) -lio -llogger -lcomm -lio -lbigmsg -o prog prog.cc
Find all posts by this user
Quote this message in a reply
12-07-2017, 07:41 PM
Post: #3
RE: Blue Logger
At preesent, blue logger does not follow the convention to create log files in /thinker/local/today... -- http://tab.d-thinker.org/showthread.php?tid=9815 -- on a Linux system.

We should make it follow the convention.

Yunong - pls create a test program for blue logger, then add code to it so that it respects our convention of log file locations.
Find all posts by this user
Quote this message in a reply
12-10-2017, 05:12 PM
Post: #4
RE: Blue Logger
(12-07-2017 07:41 PM)lingu Wrote:  At preesent, blue logger does not follow the convention to create log files in /thinker/local/today... -- http://tab.d-thinker.org/showthread.php?tid=9815 -- on a Linux system.

We should make it follow the convention.

Yunong - pls create a test program for blue logger, then add code to it so that it respects our convention of log file locations.

Will do.
Find all posts by this user
Quote this message in a reply
12-14-2017, 11:45 AM
Post: #5
RE: Blue Logger
(12-07-2017 07:41 PM)lingu Wrote:  At preesent, blue logger does not follow the convention to create log files in /thinker/local/today... -- http://tab.d-thinker.org/showthread.php?tid=9815 -- on a Linux system.

We should make it follow the convention.

Yunong - pls create a test program for blue logger, then add code to it so that it respects our convention of log file locations.

现遇到如下疑问:

1. Blue logger 生成静态库文件之后,应该是在连接到可执行文件后决定日志文件的位置,这里遵循约定的意思是直接把位置写死吗?
2. Flog.py在root下运行能直接在/thinker/local/today..下生成日志文件,与Blue logger似乎无直接联系?

麻烦顾总再解答一下,谢谢!

@lingu
Find all posts by this user
Quote this message in a reply
12-14-2017, 01:17 PM
Post: #6
RE: Blue Logger
(12-14-2017 11:45 AM)duke Wrote:  
(12-07-2017 07:41 PM)lingu Wrote:  At preesent, blue logger does not follow the convention to create log files in /thinker/local/today... -- http://tab.d-thinker.org/showthread.php?tid=9815 -- on a Linux system.

We should make it follow the convention.

Yunong - pls create a test program for blue logger,

Action on this?

Quote:then add code to it so that it respects our convention of log file locations.

现遇到如下疑问:

1. Blue logger 生成静态库文件之后,应该是在连接到可执行文件后决定日志文件的位置,这里遵循约定的意思是直接把位置写死吗?

1. Ask your mentor first.

2. DIRECT.

Quote:2. Flog.py在root下运行能直接在/thinker/local/today..下生成日志文件,与Blue logger似乎无直接联系?

麻烦顾总再解答一下,谢谢!

@lingu

That's what we should change. We log consistently. All logging facility should behave in the same systematic way.
Find all posts by this user
Quote this message in a reply
12-14-2017, 01:39 PM (This post was last modified: 12-14-2017 01:39 PM by xwcwt.)
Post: #7
RE: Blue Logger
(12-14-2017 01:17 PM)lingu Wrote:  
(12-14-2017 11:45 AM)duke Wrote:  现遇到如下疑问:

1. Blue logger 生成静态库文件之后,应该是在连接到可执行文件后决定日志文件的位置,这里遵循约定的意思是直接把位置写死吗?

1. Ask your mentor first.
Yunong asked me and I thought maybe your thought is fixing the log location to make consistent, But I am not sure then I suggest him to ask you to confirm.
Find all posts by this user
Quote this message in a reply
12-14-2017, 02:00 PM
Post: #8
RE: Blue Logger
(12-14-2017 01:17 PM)lingu Wrote:  
(12-14-2017 11:45 AM)duke Wrote:  
(12-07-2017 07:41 PM)lingu Wrote:  At preesent, blue logger does not follow the convention to create log files in /thinker/local/today... -- http://tab.d-thinker.org/showthread.php?tid=9815 -- on a Linux system.

We should make it follow the convention.

Yunong - pls create a test program for blue logger,

Action on this?

Quote:then add code to it so that it respects our convention of log file locations.

现遇到如下疑问:

1. Blue logger 生成静态库文件之后,应该是在连接到可执行文件后决定日志文件的位置,这里遵循约定的意思是直接把位置写死吗?

1. Ask your mentor first.

2. DIRECT.

Quote:2. Flog.py在root下运行能直接在/thinker/local/today..下生成日志文件,与Blue logger似乎无直接联系?

麻烦顾总再解答一下,谢谢!

@lingu

That's what we should change. We log consistently. All logging facility should behave in the same systematic way.

Got it. Will do asap.
Find all posts by this user
Quote this message in a reply
12-14-2017, 02:50 PM
Post: #9
RE: Blue Logger
(12-14-2017 01:39 PM)xwcwt Wrote:  
(12-14-2017 01:17 PM)lingu Wrote:  
(12-14-2017 11:45 AM)duke Wrote:  现遇到如下疑问:

1. Blue logger 生成静态库文件之后,应该是在连接到可执行文件后决定日志文件的位置,这里遵循约定的意思是直接把位置写死吗?

1. Ask your mentor first.
Yunong asked me and I thought maybe your thought is fixing the log location to make consistent, But I am not sure then I suggest him to ask you to confirm.

You should have directed him to create the test, create/improve pseudocode, and ask more specific question.
Find all posts by this user
Quote this message in a reply
05-03-2018, 04:20 PM
Post: #10
RE: Blue Logger
We need specify how to use blue logger in the code, such as the code sequence in auntie.cpp.

Code:
puser = getenv("USER");
  psageuser = getenv("sage_user");
  if (!psageuser) {
    psageuser = puser;
  }
  string logfile = "/thinker/local/today/users/";
  logfile += puser;
  mkdir(logfile.c_str(), 0755);
  logfile += "/auntie.log";
  //  printf("auntie: log to %s\n", logfile.c_str());                          
  initBlueLog(logfile.c_str());
  BlueLog::slogA("\n\nauntie ::", argv[0]);

We should simplify this code sequence. Ideally, it should take just one statement to initialize the log.

Qiracle pls look into it. Zhiqiang pls supervise the work.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: