/[PAMELA software]/yoda/techmodel/techmodelreader.cpp
ViewVC logotype

Diff of /yoda/techmodel/techmodelreader.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by kusanagi, Tue Aug 24 13:19:59 2004 UTC revision 1.6 by kusanagi, Thu Aug 26 08:21:31 2004 UTC
# Line 51  int main(int argc, char* argv[]) { Line 51  int main(int argc, char* argv[]) {
51  // 5                     ------------>How many times the file will be backup  // 5                     ------------>How many times the file will be backup
52     char nomeFileLog[L_tmpnam];     char nomeFileLog[L_tmpnam];
53     tmpnam(nomeFileLog);     tmpnam(nomeFileLog);
54     //std::string nomeFileLog = "YodaLog.txt";  
55     log4cpp::Appender* appender;      DIR *dirp;
    log4cpp::Category& cat = log4cpp::Category::getRoot();  
    DIR *dirp;  
56     std::string pathDir((char*)getenv("YODA_DATA"));     std::string pathDir((char*)getenv("YODA_DATA"));
         
    //std::string pathLog = pathDir + "/" + nomeFileLog;  
57     std::string pathLog = nomeFileLog;     std::string pathLog = nomeFileLog;
58     appender = new log4cpp::FileAppender("default", pathLog.c_str(), false);     log4cpp::Category& root = log4cpp::Category::getRoot();
59     log4cpp::PatternLayout * pl = new log4cpp::PatternLayout();     try{
60     pl->setConversionPattern("%d{%Y/%m/%d %H:%M:%S.%l} %p %c - %m");      std::string initFileName = pathDir + "/log4cpp.conf";
61     appender->setLayout(pl);      log4cpp::PropertyConfigurator::configure(initFileName);
62     cat.setAppender(appender);     } catch (log4cpp::ConfigureFailure& f) {
63     //cat.setPriority(log4cpp::Priority::DEBUG);      std::cerr << "Could not load log configuration from file: " << f.what() << std::endl
64                  << "Using default setup (all msgs to stdout)" << std::endl;
65        log4cpp::Appender* appender;
66        appender = new log4cpp::FileAppender("default", pathLog.c_str(), false);
67        // set a nice layout
68        log4cpp::PatternLayout * pl = new log4cpp::PatternLayout();
69        pl->setConversionPattern("%d{%Y/%m/%d %H:%M:%S.%l} %p %c - %m");
70        appender->setLayout(pl);
71        //log4cpp::Category& cat  = log4cpp::Category::getInstance("cat");
72        // remove default appender
73        cat.removeAllAppenders();
74        // use this appender for all categories
75        cat.addAppender(appender);
76        
77        // log messages from all levels.
78        //cat.setPriority(log4cpp::Priority::DEBUG);
79      //cat.setPriority(log4cpp::Priority::WARN);      //cat.setPriority(log4cpp::Priority::WARN);
80      cat.setPriority(log4cpp::Priority::INFO);      cat.setPriority(log4cpp::Priority::INFO);
81       }
82    
83      time_t rawtime;      time_t rawtime;
84      struct tm * timeinfo;      struct tm * timeinfo;
85    
86      time ( &rawtime );      time ( &rawtime );
87      timeinfo = localtime ( &rawtime );      timeinfo = localtime ( &rawtime );
88  //--------------------------------------------------    //--------------------------------------------------  
89        cat.log(log4cpp::Priority::INFO,"Importance depends on context");
90      cat << log4cpp::Priority::INFO      cat << log4cpp::Priority::INFO
91      << "<-------------------------------START UNPACKING------------------------------->\n"      << "<-------------------------------START UNPACKING------------------------------->\n"
92      << " Starting the program at: " << asctime (timeinfo) << " Opening file: " << argv[1]      << " Starting the program at: " << asctime (timeinfo) << " Opening file: " << argv[1]

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.23