00001 #ifndef FWCore_MessageService_MessageLoggerScribe_h
00002 #define FWCore_MessageService_MessageLoggerScribe_h
00003
00004 #include "FWCore/Utilities/interface/value_ptr.h"
00005 #include "FWCore/Utilities/interface/EDMException.h"
00006
00007 #include "FWCore/MessageService/interface/ELdestControl.h"
00008 #include "FWCore/MessageService/interface/MsgContext.h"
00009 #include "FWCore/MessageService/interface/NamedDestination.h"
00010 #include "FWCore/MessageService/interface/MessageLoggerDefaults.h"
00011
00012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00013
00014 #include <iosfwd>
00015 #include <vector>
00016 #include <map>
00017
00018 #include <iostream>
00019
00020 namespace edm {
00021 namespace service {
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 class MessageLoggerScribe
00067 {
00068 public:
00069
00070 MessageLoggerScribe();
00071 ~MessageLoggerScribe();
00072
00073
00074 void run();
00075
00076
00077 static ErrorLog * getErrorLog_ptr() {return static_errorlog_p;}
00078
00079 private:
00080
00081 typedef std::string String;
00082 typedef std::vector<String> vString;
00083 typedef ParameterSet PSet;
00084
00085
00086 void log(ErrorObj * errorobj_p);
00087
00088
00089 void triggerStatisticsSummaries();
00090 void triggerFJRmessageSummary(std::map<std::string, double> & sm);
00091
00092
00093 void configure_errorlog( );
00094 void configure_fwkJobReports( );
00095 void configure_ordinary_destinations( );
00096 void configure_statistics( );
00097 void configure_dest( ELdestControl & dest_ctrl
00098 , String const & filename
00099 );
00100 void configure_default_fwkJobReport( ELdestControl & dest_ctrl);
00101 void configure_external_dests( );
00102
00103 #ifdef OLDSTYLE
00104 template <class T>
00105 T getAparameter ( PSet * p, std::string const & id, T const & def )
00106 {
00107 T t;
00108 try {
00109 t = p->template getUntrackedParameter<T>(id, def);
00110 } catch (...) {
00111 t = p->template getParameter<T>(id);
00112 std::cerr << "Tracked parameter " << id
00113 << " used in MessageLogger configuration.\n"
00114 << "Use of tracked parameters for the message service "
00115 << "is deprecated.\n"
00116 << "The .cfg file should be modified to make this untracked.\n";
00117 }
00118 return t;
00119 }
00120 #else
00121 #ifdef SIMPLESTYLE
00122 template <class T>
00123 T getAparameter ( PSet * p, std::string const & id, T const & def )
00124 {
00125 T t;
00126 t = p->template getUntrackedParameter<T>(id, def);
00127 return t;
00128 }
00129 #else
00130 template <class T>
00131 T getAparameter ( PSet * p, std::string const & id, T const & def )
00132 {
00133 T t;
00134 try {
00135 t = p->template getUntrackedParameter<T>(id, def);
00136 } catch (cms::Exception& e) {
00137 try {
00138 t = p->template getParameter<T>(id);
00139 } catch (...) {
00140
00141
00142 throw e;
00143 }
00144 std::cerr << "Tracked parameter " << id
00145 << " used in MessageLogger configuration.\n"
00146 << "Use of tracked parameters for the message service "
00147 << "is not allowed.\n"
00148 << "The .cfg file should be modified to make this untracked.\n";
00149 throw e;
00150 } catch (...) {
00151
00152 throw;
00153 }
00154 return t;
00155 }
00156
00157
00158
00159 #endif
00160 #endif
00161
00162 #ifdef REMOVE
00163 template <class T>
00164 T getCategoryDefault ( PSet * p,
00165 std::string const & id,
00166 std::string const & def )
00167 {
00168 T t;
00169 t = p->template getUntrackedParameter<T>(id, def);
00170 return t;
00171 }
00172 #endif
00173
00174
00175
00176 void parseCategories (std::string const & s, std::vector<std::string> & cats);
00177 void setStaticErrorLog_ptr() {static_errorlog_p = errorlog_p;}
00178
00179
00180 ELadministrator * admin_p;
00181 ELdestControl early_dest;
00182 ErrorLog * errorlog_p;
00183 std::vector<std::ofstream *> file_ps;
00184 MsgContext msg_context;
00185 PSet * job_pset_p;
00186 std::vector<NamedDestination *> extern_dests;
00187 std::map<String,std::ostream *> stream_ps;
00188 std::vector<String> ordinary_destination_filenames;
00189 std::vector<ELdestControl> statisticsDestControls;
00190 std::vector<bool> statisticsResets;
00191 std::string jobReportOption;
00192 static ErrorLog * static_errorlog_p;
00193 bool clean_slate_configuration;
00194 value_ptr<MessageLoggerDefaults> messageLoggerDefaults;
00195 bool active;
00196
00197 };
00198
00199
00200 }
00201 }
00202
00203
00204 #endif // FWCore_MessageService_MessageLoggerScribe_h