зеркало из https://github.com/mozilla/pjs.git
add pr logging to MCD, sr=mscott 231148
This commit is contained in:
Родитель
08b8effbe7
Коммит
945cb7aa1d
|
@ -36,6 +36,10 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_LOGGING
|
||||
// sorry, this has to be before the pre-compiled header
|
||||
#define FORCE_PR_LOG /* Allow logging in the release build */
|
||||
#endif
|
||||
#include "nsAutoConfig.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
|
@ -50,6 +54,9 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nspr.h"
|
||||
|
||||
PRLogModuleInfo *MCD;
|
||||
|
||||
extern nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
|
||||
const char *filename,
|
||||
|
@ -149,6 +156,7 @@ nsAutoConfig::OnStopRequest(nsIRequest *request, nsISupports *context,
|
|||
|
||||
// If the request is failed, go read the failover.jsc file
|
||||
if (NS_FAILED(aStatus)) {
|
||||
PR_LOG(MCD, PR_LOG_DEBUG, ("mcd request failed with status %x\n", aStatus));
|
||||
return readOfflineFile();
|
||||
}
|
||||
|
||||
|
@ -158,7 +166,10 @@ nsAutoConfig::OnStopRequest(nsIRequest *request, nsISupports *context,
|
|||
PRUint32 httpStatus;
|
||||
pHTTPCon->GetResponseStatus(&httpStatus);
|
||||
if (httpStatus != 200)
|
||||
{
|
||||
PR_LOG(MCD, PR_LOG_DEBUG, ("mcd http request failed with status %x\n", httpStatus));
|
||||
return readOfflineFile();
|
||||
}
|
||||
}
|
||||
|
||||
// Send the autoconfig.jsc to javascript engine.
|
||||
|
@ -237,6 +248,7 @@ nsresult nsAutoConfig::downloadAutoConfig()
|
|||
static PRBool firstTime = PR_TRUE;
|
||||
|
||||
if (mConfigURL.IsEmpty()) {
|
||||
PR_LOG(MCD, PR_LOG_DEBUG, ("global config url is empty - did you set autoadmin.global_config_url?\n"));
|
||||
NS_WARNING("AutoConfig called without global_config_url");
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -315,8 +327,12 @@ nsresult nsAutoConfig::downloadAutoConfig()
|
|||
|
||||
rv = NS_NewURI(getter_AddRefs(url), mConfigURL.get(), nsnull, nsnull);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
PR_LOG(MCD, PR_LOG_DEBUG, ("failed to create URL - is autoadmin.global_config_url valid? - %s\n", mConfigURL.get()));
|
||||
return rv;
|
||||
}
|
||||
|
||||
PR_LOG(MCD, PR_LOG_DEBUG, ("running MCD url %s\n", mConfigURL.get()));
|
||||
// open a channel for the url
|
||||
rv = NS_NewChannel(getter_AddRefs(channel),url, nsnull, nsnull, nsnull, nsIRequest::INHIBIT_PERSISTENT_CACHING | nsIRequest::LOAD_BYPASS_CACHE);
|
||||
if (NS_FAILED(rv))
|
||||
|
|
|
@ -47,6 +47,9 @@
|
|||
#include "nsString.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIJSContextStack.h"
|
||||
#include "nspr.h"
|
||||
|
||||
extern PRLogModuleInfo *MCD;
|
||||
|
||||
// Security Manager for new XPCONNECT enabled JS Context
|
||||
// Right now it allows all access
|
||||
|
@ -111,6 +114,7 @@ autoConfigErrorReporter(JSContext *cx, const char *message,
|
|||
JSErrorReport *report)
|
||||
{
|
||||
NS_ERROR(message);
|
||||
PR_LOG(MCD, PR_LOG_DEBUG, ("JS error in js from MCD server: %s\n", message));
|
||||
}
|
||||
|
||||
nsresult CentralizedAdminPrefManagerInit()
|
||||
|
|
|
@ -55,7 +55,9 @@
|
|||
#include "prmem.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nspr.h"
|
||||
|
||||
extern PRLogModuleInfo *MCD;
|
||||
|
||||
extern nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
|
||||
const char *filename,
|
||||
|
@ -104,6 +106,8 @@ NS_IMPL_THREADSAFE_ISUPPORTS2(nsReadConfig, nsIReadConfig, nsIObserver)
|
|||
nsReadConfig::nsReadConfig() :
|
||||
mRead(PR_FALSE)
|
||||
{
|
||||
if (!MCD)
|
||||
MCD = PR_NewLogModule("MCD");
|
||||
}
|
||||
|
||||
nsresult nsReadConfig::Init()
|
||||
|
@ -165,6 +169,9 @@ nsresult nsReadConfig::readConfigFile()
|
|||
|
||||
rv = prefBranch->GetCharPref("general.config.filename",
|
||||
getter_Copies(lockFileName));
|
||||
|
||||
|
||||
PR_LOG(MCD, PR_LOG_DEBUG, ("general.config.filename = %s\n", lockFileName.get()));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -199,9 +206,13 @@ nsresult nsReadConfig::readConfigFile()
|
|||
|
||||
PRInt32 obscureValue = 0;
|
||||
(void) prefBranch->GetIntPref("general.config.obscure_value", &obscureValue);
|
||||
PR_LOG(MCD, PR_LOG_DEBUG, ("evaluating .cfg file %s with obscureValue %d\n", lockFileName.get(), obscureValue));
|
||||
rv = openAndEvaluateJSFile(lockFileName.get(), PR_TRUE, obscureValue, PR_TRUE);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
PR_LOG(MCD, PR_LOG_DEBUG, ("error evaluating .cfg file %s %x\n", lockFileName.get(), rv));
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = prefBranch->GetCharPref("general.config.filename",
|
||||
getter_Copies(lockFileName));
|
||||
|
|
Загрузка…
Ссылка в новой задаче