cancel
Showing results for 
Search instead for 
Did you mean: 

OnBase 17 Unity Script logging control?

Alex_French
Elite Collaborator
Elite Collaborator

I know OnBase 17 (maybe 16?) introduces a nifty feature where a developer can toggle logging levels for individual Unity Scripts in the OnBase Studio GUI.

Most of our existing dozens of Unity Scripts use libraries that look at a Unity Configuration Item and set the Diagnostics Level accordingly, making it easy to ramp up or down logging for a whole solution set of scripts.  It is definitely less granular than the new per-script toggling option.

In the long run we might simplify and rely on the built-in feature, we might make our libraries smarter, we might use the new feature for new solutions but not retrofit older ones, anything is on the table.  But in the short run, we just need to know what is the minimum amount of work that will let us know what logging we're going to get and how to adjust it, as part of upgrading from OnBase 15 to OnBase 17.

Can anyone point me to one place that would summarize how the new feature works and how it would interact with the traditional way of setting the level programmatically?

-SDK?  (hint: the section "Diagnostics Logging For Unity Scripts" is another new feature I'm glad to know about, but it isn't this)

-MRG?  (the Studio MRG tells me about the dialog box for setting a default level, but it doesn't tell me how the setting actually works)

-API Blog post with more detail?

-Anyone's personal experience?

Thanks for any information anyone has to share!

1 ACCEPTED ANSWER

Bryan_Sorensen
Confirmed Champ
Confirmed Champ

Any changes made within the script to diagnostics level will override the GUI setting. I highly recommend using the GUI setting when possible as it removes the need to manage configuration items or to rebuild scripts that are hard-coded with diagnostics levels.

Bryan Sorensen

API Analyst| OCAPI - OCI

API Support Team

View answer in original post

7 REPLIES 7

Seth_Yantiss
Star Collaborator
Star Collaborator

Alex,

The new feature came out in V16.  It is documented in the SDK under app.Diagnostics.WriteIf. 

There is an object/property called "Level" that can be set in script like with the following:

app.Diagnostics.Level = Diagnostics.DiagnosticsLevel.Verbose

The first parameter of the WriteIf is the "level" under which the entry will be written to the console:

app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Verbose,"This event would be written if the app.Diagnostics.Level was set to verbose, but not under.")

Seth, could you be more specific about the SDK contents? In the current content at sdk.onbase.com, for the Diagnostics.WriteIf method overloads, I don't see any more detail...

Oh, I just re-read your answer, and I realize I was unclear- we use WriteIf and setting of levels extensively. Right now we do it all programmatically, and I'm trying to understand how that interacts with the GUI setting.

Based on what Nevin said, I think that either (a) my co-workers testing has exposed some bugs in the behavior or (b) her careful testing, and what I watched her do, must have been missing something and not proved what we think it proved (hopefully).

Nevin_Steindam
Star Contributor
Star Contributor

What information are you looking for? I am happy to discuss my experiences with it.

In short: Each script has a setting for the diagnostics level. This setting determines the initial value of app.Diagnostics.Level. You can still reference that property to see what is set, and you can even change it mid-script if you want. (For example, if you keep using your current library that sets the level, that will override the initial script-level setting.)

You can think of this setting as an implicit line of code at the start of your main method that says:
app.Diagnostics.Level = XXX;
Everything after that works the same.

[Edited to correct the name of the "Level" property.]

Alex_French
Elite Collaborator
Elite Collaborator
Thanks Nevin. That sounds like it shouldn't require any immediate action on our part.

That seems like what I assumed, but my co-worker had some weird experiences that got us confused. We'll have to test that out more carefully and come back (here first for good info, FLOS Team M depending...)