Dan Smith recently started a proposal page for a conventional way for a FileMaker application event log to work. I think the idea could stand to be fleshed out a little more in this forum. So what logs have folks built for themselves or seen out in the wild? What worked well and what didn't?One fruitful place to start might be to survey the functionality of more solidly standardized logging practices in other technologies, such as the Syslog that Dan linked to.. There's a lot of logging experience out there for us to benefit from. Further, if whatever we come up with is at least in some way intercompatible with, if not simply a FileMaker implementation of, some other logging standard we like, the FileMaker logging starts life with some of the credibility of the existing standard.
--
You received this message because you are subscribed to the Google Groups "fmstandards" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fmstandards...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
As far as I know, most established logging systems utilize a text file where each line represents a log entry and each piece of data in a log entry is delimited in some way (spaces, tab, comma, etc.). This is fundamentally different that what we are dealing with in FileMaker, especially if it's going to accommodate miscellaneous name/value pairs, as those created by my Error* and LogData custom functions. Does anybody know of another logging system that uses a key/value pair storage method?
We're not dealing with anything in FileMaker yet.
...
And who said anything about a dictionary storage method? I'm sure it could be fine, but I'm presuming this conversation is starting from scratch. I'm interested to see the argument for it re-articulated.
--
So, I suggest we assume the source data for a log entry is received in name/value pair format; at least until an alternative is suggested.
On Tuesday, November 26, 2013 2:22:11 PM UTC-5, dansmith65 wrote:
So, I suggest we assume the source data for a log entry is received in name/value pair format; at least until an alternative is suggested.
The format that the source data for a log entry is received in is not necessarily the format that the log entry data are recorded or exported in. The most universal feature of the different logging standards, formats, and tools I've looked at so far is block of text for whatever message the application chooses to record — exactly the kind of place we could hypothetically dump a string of Let notation into. Let notation is quickly becoming the most popular dictionary format for passing data around within FileMaker applications, but there are external forces worth considering. We have the influence to modify the error data packet/struct/thing functions to suit whatever other standards, formats, and tools we decide are important. We do not have the same influence over the other standards, formats, and tools. So any requirements we choose to impose on ourselves to support interacting with logging systems that other folks have already devised are the more rigid constraints to consider, and I believe the more fruitful place to start the conversation.
I don't know that you guys are interested or have access to the magazine site, but I can give you access if you want it. The video I shot about Error handling uses a logging format where I simply use the name of the field itself to extract the value from local variable with the exact same name as the field. This allows me to simply duplicate a field and rename as needed. Very low friction.
To follow-up on looking for other influences, these are some of the other logging solutions I've looked at so far:What else is out there? Are any of these any good?The most universal feature is a way to record whatever message the application cares to fit in a string of text for each event. Let's keep that.The next most common feature is a timestamp for each event (usually UTC and to millisecond precision if it can be helped). Let's keep that, too.
The next most common feature is a way to categorize recorded events by a flag that usually gets called a log "level," which I personally think is an unfortunate word choice. If we want to include log levels, there is more thinking to do. The log level means different things to different logging tools and standards. Sometimes the log level is used to filter which events get recorded in the log based on some setting read at runtime — "debug" log messages might be recorded by a developer while trying to fix a broken script, but not while users are working in a deployed application so that the data logged is throttled to a reasonable quantity. Sometimes all log messages are recorded, and the log level is used to filter the display of events, or to log different events in different places. Sometimes the log level indicates the appropriate priority and urgency of action to take in response to an event. Sometimes the log level is nominal data — just a categorical tag — and sometimes the log levels are ordinal data — the different log levels have a particular order relative to each other. What do folks think about these different approaches? Should we adopt one of the existing level schemes as our own, pick & choose, or come up with something entirely new? If we want to interact with any formats, do we adopt the most thorough approach and pare the information down when exporting to a less detailed standard, or adopt the simplest and rely on some extensibility mechanism?
Some other common features include:
- Means to identify the source of the log message, ranging in detail from an IP address to an application name to a complete stack trace.
- A status or error code for each event.
One uncommon but tempting feature is the ability to record structured arbitrary fields of data for each event.
--
The last change I made to the sample file used a similar idea of auto-entering a value in fields based on the field's name. I've still stuck with the ScriptLog/ScriptLogItem relationship for displaying all the name/value pairs, but I wanted to save a few values in the ScriptLog table, for viewing as a list. I'd like to see how you handled logging of miscellaneous names you don't have a field for.
Jeremy,UTC timestamp's sound like a good idea. The only way I know how to get this without a plug-in is via Get ( UTCmSecs ), which is based on the client's computer's clock (I assume!). I think it would be more consistent to base a timestamp on the server's clock via Get ( CurrentHostTimestamp ). Unless there is another way to get sub-second UTC time, I'm not sure that it would add any value over the server's time since each client's clock may be slightly different from one another.Actually, thinking through this as I type, the added value of using Get ( UTCmSecs ) would be that log entries created by a single client could be compared to each other with sub-second increments.
For the purposes of coming up with a standard, I wonder if we'd be better off focusing on the interface FileMaker applications use to send events to the log rather than the implementation
Either answer sounds like an implementation detail more than part of the interface to standardize.
--
For the purposes of coming up with a standard, I wonder if we'd be better off focusing on the interface FileMaker applications use to send events to the log rather than the implementationI think that's a good idea. I propose we use the interface implemented in my sample file. I designed the implementation around that exact idea: everyone may use different "Log Writers" (as I called them in the sample file), but the generic "Logger: Create Entry ( logData )" script provides the entry point for the creation of all log entries.I also propose the use of the LogData custom function as the standard method of collecting environmental data for logging.
--
If we're talking about best practices rather than standards, I'd say that substantially lowers the threshold of acceptance for each practice. I like it. I don't hear anyone complaining about accepting arbitrary dictionaries of data to suit each applications whims. We've already brought up 3 values that solutions really ought to have special treatment for, but with exceptions. What else is there that goes beyond "I find this data point handy sometimes, but you can take it or leave it" to "you really ought to track this if you want to be taken seriously" that we haven't brought up in this thread yet? Current layout (ID) comes to mind for the former category, and account name comes to mind for the latter.
Data I strongly suggest everyone collect with every log entry:
- LogLevel
- TimeStamp
- AccountName
- ScriptName
- ScriptParameter
Jeremy, given your favoritism towards singular functions I would think that the following a format would be something you would like.
- LogError()
- LogWarn()
- LogNotice()
- LogDebug()
etc...
I haven't heard any objections to the LogData function. That seems like a pretty solid practice. However, I've seen several variations on it. LogData with no parameters. LogData ( logLevel ). LogData ( message ; logLevel ). A few non-FileMaker solutions seem to like having a separate logging function for each logLevel. Any favorites?
Another practice that I have is to log a full set of environment variables at login, as errors only occur after that happens. They are collected as name/value pairs in a return separated list and passed to the standard log script as a message. It’s good enough for reference purposes and it ensures that there is a record in case the problem that the user is complaining about isn’t generating an error.
On Wednesday, December 11, 2013 6:06:50 PM UTC-5, Malcolm Fitzgerald wrote:Another practice that I have is to log a full set of environment variables at login, as errors only occur after that happens. They are collected as name/value pairs in a return separated list and passed to the standard log script as a message. It’s good enough for reference purposes and it ensures that there is a record in case the problem that the user is complaining about isn’t generating an error.I like that. It seems to me to imply a need for a session ID to be included in the log so those environmental variables can be related to the log entries that don't contain those data — a Huffman coding of log data, in effect.
I like it.One thing I noticed looking at other event logging schemes is that numeric log levels usually represent increasingly critical events as the log level number decreases. The lower the log level, the more a fast resolution to a problem might warrant detailed diagnostic data (if we chose to embrace a similar convention). In light of that, it might make sense for any extra dictionary data to be included when log levels are less that certain thresholds rather than exact matches.
--