project BLF > class TDaemonUtility > method SetDaemonDebugLevelInternal


Parameters


icDaemonNameinputcharacter
iiDebugLevelinputinteger


Internal usage


BLF
method TDaemonUtility.SetDaemonDebugLevel


program code (program1/tdaemonutility.p)

vcFilename = search (caps(icDaemonName) + ".config").
if vcFilename = ?
then do:
    /* Make the config file on the same place as the server.xml */
    vcFilename = search ("server.xml").
    if vcFilename <> ?
    then do:
        vcFilename = replace (vcFilename, "server.xml", caps(icDaemonName) + ".config").
        <M-18 run CreateDaemonConfig
           (input  vcFilename (icFilename), 
            input  iiDebugLevel (iiDebugLevel), 
            input  icDaemonName (icDaemonName)) in TDaemonUtility>
    end.
end.
else do:
    copy-lob from file vcFilename to vpLogFile.
    viFrom = index (vpLogFile,"DebugLevel=").
    if viFrom = 0
    then vpLogFile = vpLogFile + chr(10) + chr(10) + "DebugLevel=" + string(iiDebugLevel) + chr(10).
    else do:
        viOffset = 11.
        /* looking for numbers */
        do while true:
            vcDebug = substring(vpLogFile,viFrom + viOffset,1,"character").
            if asc(vcDebug) < 48    /*0*/
            or asc(vcDebug) > 57    /*9*/
            then leave.
            viOffset = viOffset + 1.
        end.
        substring(vpLogFile,viFrom,viOffset,"character") = "DebugLevel=" + string(iiDebugLevel).
    end.
    copy-lob from vpLogFile to file vcFilename.
end.