Logging to the application server? Pfft. There are a lot of great logging tools (one that Epicor is actually using) that will log to multiple targets - including where you can set triggers to notify you of issues proactively.
Presumably you can write to any file location accessible to both you and the user using standard C# code?
Otherwise, if it’s just while you’re working on it and you want to avoid annoying users, I tend to add a couple of Script-level variables like
bool debug;
string debuguser;
Then prefix the MessageBox calls with a check to whether debugging is on and it’s me running the form. It’s crude, but the immediate feedback is usually what I need and it saves clogging up drives with text files.
I would not write to a log file from a Customization. Because a Customization runs on the Client and under the users Windows Account, the user is at the mercy of having access and permissions to the Path you want to log to. If you can assure Terminal Users and non Local-Admins etc all have access good.
Also you will need to setup a Setting so you can read where to log to, you dont want to hard-code the Path. So maybe on Company Maintenance add a field called Company_UD.ClientSideLogPath_c – You can read the folder from the Agent Settings too, but typically in your Env they have a specific Folder they want to target.
@bradberkobien you could also enclose the messagebox in an if statement to only display for your account or if the account belongs to a specific security group, if only needed to debug. Better idea to debug is create a copy of the current customization and debug that one if other users are accessing the customization. Better yet, use Visual Studio to debug…
Another thing that some people do, to indicate merely a “Progress Log” is they place a Large Multi-Line Textbox on the Form and simply keep writing to that, so the user can review it. (Looks at @Chris_Conn MAK V5)
// Status Text: Ready
this.oTrans.PushStatusText("Cat.."); // Status Text: Cat...
this.oTrans.PushStatusText("Mouse.."); // Status Text: Mouse...
this.oTrans.PopStatus(); // Status Text: Cat...
this.oTrans.PopStatus(); // Status Text: Ready
using(System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Temp\" + res + "_Directive_TraceMaintReq.log", true)) //my file is on server, under c:\temp
{
bool log = true;
//I use a var so at the end the logging, it can stay, just put log to false...
if(log)
{
file.WriteLine("");
file.WriteLine(string.Format("BPM MaintReq (CaptureContextInfo) Date {0} by {1}", DateTime.Now, callContextClient.CurrentUserId));
}
//your directive code
}