一开始自己写LOG类。
JAVA LOG类
LOG4J
LOGCPLUS
现在就是下面的东西(ACE里面的LOG),简单学习下,其实很强大的,类似
LOG4J
====================================================================
#include "stdafx.h"
#include "ace\ACE.h"
#include "ace\Task.h"
#include "ace\Log_Msg.h"
//#include "ace\OS_main.h"
//#include "ace\Stream.h"
#include <iostream>
#include <fstream>
using std::ios_base;
int main(int argc, char* argv[])
{
int i = 0;
const char *filename = "Info.log";
std::ofstream myostream(filename, ios_base::out |ios_base::binary);
if (myostream.bad())
return 1;
// Set the ostream.
ACE_LOG_MSG->msg_ostream(&myostream);
ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
while(true){
ACE_DEBUG((LM_INFO,"in service[%d], MsgType:%M, Program: %n, ThreadID: %t\n",i));
Sleep( 10 );
i++;
}
return 0;
}
JAVA LOG类
LOG4J
LOGCPLUS
现在就是下面的东西(ACE里面的LOG),简单学习下,其实很强大的,类似
LOG4J
====================================================================
#include "stdafx.h"
#include "ace\ACE.h"
#include "ace\Task.h"
#include "ace\Log_Msg.h"
//#include "ace\OS_main.h"
//#include "ace\Stream.h"
#include <iostream>
#include <fstream>
using std::ios_base;
int main(int argc, char* argv[])
{
int i = 0;
const char *filename = "Info.log";
std::ofstream myostream(filename, ios_base::out |ios_base::binary);
if (myostream.bad())
return 1;
// Set the ostream.
ACE_LOG_MSG->msg_ostream(&myostream);
ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
while(true){
ACE_DEBUG((LM_INFO,"in service[%d], MsgType:%M, Program: %n, ThreadID: %t\n",i));
Sleep( 10 );
i++;
}
return 0;
}