|
static bool | paramFileCopy (string xmlFile, ParamFileCopy pfcopy, string trigger, string prncpl, string command) |
| Used by a trigger to save the content of the XML param file passed to it by AccuRev to %LOCALAPPDATA%\AcTools\Param\<trigger-command-principal-timestamp>.xml . More...
|
|
static bool | paramFileCopy (ParamFileCopy pfcopy, string xml, string trigger, string prncpl) |
| Used by the server_auth_trig to save the content of the XML param data passed to it by AccuRev to %LOCALAPPDATA%\AcTools\Param\server_auth_trig-principal-timestamp.xml . More...
|
|
static void | Log (string message, bool formatting=true) |
| Write the message text to STDOUT, to weekly log files located in %LOCALAPPDATA%\AcTools\Logs , and to trigger.log in the AccuRev server's ..storage\site_slice\logs folder in the case of triggers. More...
|
|
static void | Log (string message, string xmlParamFile, bool formatting=true) |
| Used by triggers, this method overload includes all functionality of Log(string, bool) and adds overwriting the trigger's xmlParamFile with the message text so it is displayed in the console or error dialog given to the user on trigger failure. More...
|
|
static bool | initAcLogging () |
| Initialize application logging support, for general purpose or error messages, in conjunction with a client application's <prog_name>.exe.config file and Log(string, bool). More...
|
|
static string | getLogFile () |
| Get the log file's full path name. More...
|
|
static void | unhandledException (object sender, UnhandledExceptionEventArgs args) |
| Ensure that an unhandled exception gets logged to %LOCALAPPDATA%\AcTools\Logs\<prog_name>-YYYY-MM-DD.log before the system default handler terminates the application. More...
|
|
static void | errorDataHandler (object sendingProcess, DataReceivedEventArgs errLine) |
| Centralized error handler. More...
|
|
Use to log and display error and general purpose text messages, and to save the XML param data sent by AccuRev to a trigger for development, debugging, and troubleshooting purposes. For OS environment problems, log the system network activity generated by the program by modifying <prog_name>.exe.config
similar to this version.
Definition at line 100 of file AcDebug.cs.
static bool AcUtils.AcDebug.entryInTrigTargetsFile |
( |
string |
trigger, |
|
|
string |
prncpl |
|
) |
| |
|
inlinestaticprivate |
Determine if an entry exists for this user and trigger combo in TriggersTarget.xml
.
Use the CopyParmFileTrigTarget enum directive in the appSettings section of a <trigger>.exe.config
file (located in the same folder as the trigger's executable) to have the trigger's XML param data copied to %LOCALAPPDATA%\AcTools\Param\<trigger-command-principal-timestamp>.xml
for specific users and triggers. Only param data for matching entries in TriggersTarget.xml
located on the AccuRevTriggers network share are copied.
- Parameters
-
trigger | The name of the trigger sent by AccuRev. |
prncpl | Name of the principal sent by AccuRev. |
- Returns
- true if entry exists, false otherwise.
- Exceptions
-
XPathException | caught and logged in %LOCALAPPDATA%\AcTools\Logs\<trig_name>-YYYY-MM-DD.log on xpath failure. |
Exception | caught and logged in same on failure to handle a range of exceptions. |
- In <trigger>.exe.config:
<appSettings>
...
<add key="ParamFileCopy" value="CopyParmFileTrigTarget" />
</appSettings>
- Example TriggersTarget.xml:
<Triggers>
<Trigger Name="server-post-promote">
<Principal Name="barnyrd"></Principal>
</Trigger>
<Trigger Name="server_admin_trig">
<Principal Name="robert"></Principal>
<Principal Name="barnyrd"></Principal>
</Trigger>
<Trigger Name="server_preop_trig">
<Principal Name="thomas"></Principal>
</Trigger>
<Trigger Name="server_auth_trig">
<Principal Name="madhuri"></Principal>
<Principal Name="thomas"></Principal>
</Trigger>
</Triggers>
Definition at line 332 of file AcDebug.cs.
Referenced by AcUtils.AcDebug.paramFileCopy().
static bool AcUtils.AcDebug.initAcLogging |
( |
| ) |
|
|
inlinestatic |
Initialize application logging support, for general purpose or error messages, in conjunction with a client application's <prog_name>.exe.config
file and Log(string, bool).
Creates weekly log files in %LOCALAPPDATA%\AcTools\Logs
in the format <prog_name>-YYYY-MM-DD.log
with the first day of the current week in the file name. The AcTools\Logs
folder is created if not already there. Log files can grow to a maximum of 80MB in size. At least 2.3GB free space must exist for logging to continue. Additional log files are created with an iteration part (blue circle) should a write conflict occur:
- Returns
- true if logging support successfully initialized, false on error.
- Exceptions
-
Exception | caught on failure to handle a range of exceptions with error sent to STDOUT. |
- Example usage:
string error;
if (!AcDebug.initAcLogging())
{
MessageBox.Show(error, "PromoHist", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return;
}
- XML that must exist in <prog_name>.exe.config. Change source name attribute to <prog_name>.
<system.diagnostics>
<assert assertuienabled="false"/>
<sources>
<source name="PromoHist"> <!-- name attribute value must be program executable's root name -->
<listeners>
<remove name="Default" />
<add name="AcLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</listeners>
</source>
</sources>
</system.diagnostics>
Definition at line 471 of file AcDebug.cs.
static void AcUtils.AcDebug.Log |
( |
string |
message, |
|
|
string |
xmlParamFile, |
|
|
bool |
formatting = true |
|
) |
| |
|
inlinestatic |
Used by triggers, this method overload includes all functionality of Log(string, bool) and adds overwriting the trigger's xmlParamFile with the message text so it is displayed in the console or error dialog given to the user on trigger failure.
Results from AccuRev commands issued on the command line are sent to STDOUT for both success and failure. For the AccuRev GUI, results are discarded if the program return value is zero (0) (Success). For triggers that return a non-zero program return value (Failure), the message text will display in the console or error dialog provided the xmlParamFile sent by AccuRev was overwritten with it. Otherwise, the raw XML param data will display which is not user-friendly.
- Parameters
-
message | The text to be logged and displayed to the user on trigger failure. |
xmlParamFile | The XML trigger param file sent by AccuRev to the trigger. |
formatting | true to include the date, time and newline formatting in the log file. false for no formatting. |
- Exceptions
-
Exception | caught and logged in %LOCALAPPDATA%\AcTools\Logs\<trig_name>-YYYY-MM-DD.log on failure to overwrite the XML param file. |
- See also
- AcUtils.ParamFileCopy
Definition at line 413 of file AcDebug.cs.