Added logging config as a distinct feature
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Mon, 26 Apr 2004 15:45:51 +0000 (15:45 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Mon, 26 Apr 2004 15:45:51 +0000 (15:45 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@1053 cb58f699-b61c-0410-a6fe-9272a202ed29

isapi_shib/isapi_shib.cpp
shar/shar.cpp
shib-target/shib-ini.cpp
shib-target/shib-target.h

index c18fb6c..08351d1 100644 (file)
@@ -158,7 +158,8 @@ extern "C" BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pVer)
             ShibTargetConfig::Metadata |
             ShibTargetConfig::AAP |
             ShibTargetConfig::RequestMapper |
-            ShibTargetConfig::SHIREExtensions
+            ShibTargetConfig::SHIREExtensions |
+            ShibTargetConfig::Logging
             );
         if (!g_Config->init(schemadir,config)) {
             g_Config=NULL;
index 04f20b5..47e6866 100644 (file)
@@ -156,7 +156,7 @@ int real_main(int preinit)
             ShibTargetConfig::Credentials |
             ShibTargetConfig::AAP |
             ShibTargetConfig::SHARExtensions |
-            (shar_checkonly ? (ShibTargetConfig::SHIREExtensions | ShibTargetConfig::RequestMapper) : 0)
+            (shar_checkonly ? (ShibTargetConfig::SHIREExtensions | ShibTargetConfig::RequestMapper) : ShibTargetConfig::Logging)
             );
         if (!shar_config)
             shar_config=getenv("SHIBCONFIG");
@@ -319,7 +319,7 @@ int main(int argc, char *argv[])
         ShibTargetConfig::Credentials |
         ShibTargetConfig::AAP |
         ShibTargetConfig::SHARExtensions |
-        (shar_checkonly ? (ShibTargetConfig::SHIREExtensions | ShibTargetConfig::RequestMapper) : 0)
+        (shar_checkonly ? (ShibTargetConfig::SHIREExtensions | ShibTargetConfig::RequestMapper) : ShibTargetConfig::Logging)
         );
     if (!conf.init(shar_schemadir,shar_config)) {
         fprintf(stderr, "configuration is invalid, check log for specific problems\n");
index c35dec0..5f946a3 100644 (file)
@@ -658,27 +658,26 @@ void XMLConfigImpl::init(bool first)
         const DOMElement* SHIRE=saml::XML::getFirstChildElement(ReloadableXMLFileImpl::m_root,ShibTargetConfig::SHIBTARGET_NS,SHIBT_L(SHIRE));
 
         // Initialize log4cpp manually in order to redirect log messages as soon as possible.
-        const XMLCh* logger=NULL;
-        if (conf.isEnabled(ShibTargetConfig::SHARExtensions))
-            logger=SHAR->getAttributeNS(NULL,SHIBT_L(logger));
-        else if (conf.isEnabled(ShibTargetConfig::SHIREExtensions))
-            logger=SHIRE->getAttributeNS(NULL,SHIBT_L(logger));
-        if (!logger || !*logger)
-            logger=ReloadableXMLFileImpl::m_root->getAttributeNS(NULL,SHIBT_L(logger));
-        if (logger && *logger) {
-            auto_ptr_char logpath(logger);
-            cerr << "loading new logging configuration from " << logpath.get() << "\n";
-            try {
-                PropertyConfigurator::configure(logpath.get());
-                cerr << "New logging configuration loaded, check log destination for process status..." << "\n";
-            }
-            catch (ConfigureFailure& e) {
-                cerr << "Error reading logging configuration: " << e.what() << "\n";
+        if (conf.isEnabled(ShibTargetConfig::Logging)) {
+            const XMLCh* logger=NULL;
+            if (conf.isEnabled(ShibTargetConfig::SHARExtensions))
+                logger=SHAR->getAttributeNS(NULL,SHIBT_L(logger));
+            else if (conf.isEnabled(ShibTargetConfig::SHIREExtensions))
+                logger=SHIRE->getAttributeNS(NULL,SHIBT_L(logger));
+            if (!logger || !*logger)
+                logger=ReloadableXMLFileImpl::m_root->getAttributeNS(NULL,SHIBT_L(logger));
+            if (logger && *logger) {
+                auto_ptr_char logpath(logger);
+                cerr << "loading new logging configuration from " << logpath.get() << "\n";
+                try {
+                    PropertyConfigurator::configure(logpath.get());
+                    cerr << "New logging configuration loaded, check log destination for process status..." << "\n";
+                }
+                catch (ConfigureFailure& e) {
+                    cerr << "Error reading logging configuration: " << e.what() << "\n";
+                }
             }
         }
-        else {
-            Category::getRoot().setPriority(Priority::DEBUG);
-        }
         
         // First load any property sets.
         load(ReloadableXMLFileImpl::m_root,log,this);
index da7a0b6..c6a96dd 100644 (file)
@@ -244,7 +244,8 @@ namespace shibtarget {
             AAP = 32,
             RequestMapper = 64,
             SHARExtensions = 128,
-            SHIREExtensions = 256
+            SHIREExtensions = 256,
+            Logging = 512
         };
         void setFeatures(long enabled) {m_features = enabled;}
         bool isEnabled(components_t feature) {return (m_features & feature)>0;}