Force showing logs in trace before the configuration is loaded.

This commit is contained in:
Ghazi Triki 2015-07-30 09:25:13 +01:00
parent 83666a7caa
commit 31892ca0de
2 changed files with 50 additions and 29 deletions

View File

@ -22,8 +22,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:views="*"
pageTitle="BigBlueButton"
layout="absolute"
layout="absolute"
preinitialize="LogUtil.initLogging(true)"
preloader="org.bigbluebutton.main.model.BigBlueButtonPreloader">
<mx:Script>
<![CDATA[
import org.bigbluebutton.common.LogUtil;
]]>
</mx:Script>
<views:BigBlueButtonMainContainer id="bbbShell"/>

View File

@ -40,39 +40,54 @@ package org.bigbluebutton.common
/**
* Initialises logging from the application configuration.
*/
public static function initLogging():void
public static function initLogging(force:Boolean = false):void
{
var lxml:XML=BBB.initConfigManager().config.logging;
if (lxml.@enabled != undefined)
{
loggingEnabled=(lxml.@enabled.toString().toUpperCase() == "TRUE") ? true : false;
}
if (lxml.@target != undefined)
{
loggingTargetName=lxml.@target.toString().toLowerCase();
}
if (loggingEnabled)
{
var logTarget:IFormattingLogTarget;
switch (loggingTargetName)
{
case TRACE:
logTarget=new TraceTarget();
break;
case LOG_WINDOW:
logTarget=new LogWindowTarget();
break;
case JSNLOG:
logTarget=new JSNLogTarget();
break;
default:
// no logging target set
break;
}
var logTarget:IFormattingLogTarget;
if (force)
{
logTarget=new TraceTarget();
}
else
{
var lxml:XML=BBB.initConfigManager().config.logging;
if (lxml.@enabled != undefined)
{
loggingEnabled=(lxml.@enabled.toString().toUpperCase() == "TRUE") ? true : false;
}
if (lxml.@target != undefined)
{
loggingTargetName=lxml.@target.toString().toLowerCase();
}
if (loggingEnabled)
{
switch (loggingTargetName)
{
case TRACE:
logTarget=new TraceTarget();
break;
case LOG_WINDOW:
logTarget=new LogWindowTarget();
break;
case JSNLOG:
logTarget=new JSNLogTarget();
break;
default:
// no logging target set
break;
}
}
}
if (logTarget)
{
logTarget.format=DEFAULT_FORMAT;
LOGGER_FACTORY.setup=new SimpleTargetSetup(logTarget);
}
else
{
disableLogging();
}
}
/**