svn rev #22102: tools/gssmonger/trunk/gssmaster/
raeburn@MIT.EDU
raeburn at MIT.EDU
Mon Mar 16 15:47:28 EDT 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=22102
Commit By: raeburn
Log Message:
don't open a new fd for each block; set appenders on root and inherit
Changed Files:
U tools/gssmonger/trunk/gssmaster/ezlog_log4cpp.cpp
Modified: tools/gssmonger/trunk/gssmaster/ezlog_log4cpp.cpp
===================================================================
--- tools/gssmonger/trunk/gssmaster/ezlog_log4cpp.cpp 2009-03-16 19:39:37 UTC (rev 22101)
+++ tools/gssmonger/trunk/gssmaster/ezlog_log4cpp.cpp 2009-03-16 19:47:27 UTC (rev 22102)
@@ -152,6 +152,7 @@
};
//Category *cat = NULL;
static CatStack *cats = NULL;
+static Appender *app = NULL, *appConsole = NULL;
// Start a new log4cpp log
EZLOGAPI ezStartBlock(IN OPTIONAL HANDLE OldLevel,
@@ -160,12 +161,16 @@
IN OPTIONAL ULONG LogLevel,
IN LPEZSTR LogString,
...) {
-
- Appender* app = new FileAppender("FileAppender", "gssmaster.log");
- Appender* appConsole = new OstreamAppender("OstreamAppender", &(std::cout));
- Layout* layout = new BasicLayout();
- app->setLayout(layout);
+ if (app == NULL) {
+ app = new FileAppender("FileAppender", "gssmaster.log");
+ app->setLayout(new BasicLayout());
+ Category::getRoot().setAppender(app);
+ }
+ if (appConsole == NULL) {
+ appConsole = new OstreamAppender("OstreamAppender", &(std::cout));
+ Category::getRoot().setAppender(appConsole);
+ }
static ULONG BlockCounter = 0;
@@ -181,8 +186,6 @@
Category *cat = &Category::getInstance(LogName);
cat->setAdditivity(true);
- cat->setAppender(app);
- cat->setAppender(appConsole);
cats = new CatStack(cat, cats);
ezLogMsg(EZLOG_BLOCK, EZ_DEFAULT, "StartBlock %p from %p(%s): %s",
@@ -278,6 +281,10 @@
// Close the log4cpp log
EZLOGAPI ezCloseLog( IN OPTIONAL ULONG flags, ... ) {
Category::shutdown();
+ delete app;
+ app = NULL;
+ delete appConsole;
+ appConsole = NULL;
}
// Open the log4cpp log
More information about the cvs-krb5
mailing list