Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

hecon5
Copy link
Contributor

@hecon5 hecon5 commented Jul 10, 2025

This closes #507, #673, #666

First to demonstrate the log speed (this new one is FAST), and to maintain the functionality of the existing code (a whole-system refactor is not super duper desirable), and to incorporate the remaining elements of the log tool.

Remaining elements:

  • Persistent token for operation. this would identify the specific operation that's being done (build/export/export just one...etc.) and would be used to identify the relevant log entries to grab. Doing this would make it so if the log didn't get deleted each time we could grab relevant info. This also makes it so if we somehow perform more than one operation at once (automated building), or where the addin is called from two different Access instances you could perform an operation on both instances at once without log entries getting mixed up.
  • log import/export for selected operation token
  • clsOptions
    • Log Level (currently natively part of the new log class, but is not implemented in options) (Added to options)
    • DisplayLogLevel
    • Add Upgrade Options for ShowDebug
    • [-] Remove ShowDebug as an option.
      • [-] ShowDebug is used 32 times. Suggest setting those use cases to an event level of eelDebugTrace, eelDebugEvent, or eelDebugInfo
      • Alternately: could just create an option that is If Options.DisplayLogLevel < eelNoError Then Options.ShowDebug = True (this seems the easiest way to handle it, actually)
    • Set LogLevel and DisplayLogLevel after Options are loaded
    • Whether logs are persistent or transient (per export) (default to not persistent)
      • Replicated existing method
    • What fields are logged (meta data)
      • Username
      • Computer name
      • Operation and Operation State (captured in clsErrorInfo)
      • [-] others?
      • Current file being built
      • Addin Path?
    • Add persistence mode (defaults to off).
    • Determine how to parse the XML to a human readable output.
      • [-] Do we need to save the color/HTML the console displays?
      • [-] Can this be easily parsed to MarkDown?
      • Removing some HTML Tags but not all seems to do nicely.
  • frmOptions:
    • Change Show Debug Checkbox to dropdown option for DisplayLogLevel.
    • add dropdown for LogLevel
    • Add option for persistent log (future). Current operation method will make this perform the same as currently happens (non-persistent logs).
  • Get connection to the addin corrected; currently will only call the local program, but getting a connection to the addin shouldn't be too bad.
  • Log persistence; the current tool exports the log to an xml file; need to implement a tool to pick that log back up into the log from the last exports; once you close the addin (from the built database) the addin resets to the previous state. To make the log persistent, we need to either reimport the previous values OR append them to the previous export.
    • It turns out the log is persistent when a table in the addin is used.
  • Ensure backwards compatibility with previous log
  • Determine how to handle "Private" log information that would be very valuable to a internal dev team, but should not be sent out. These would be especially informative for projects that share a dev space, and / or have a runner that's triggered by merge events.
    • for now, defaulting private values to Off, and exposed an optional setting to log those.
    • Username
    • Computer Name
    • others?
    • Use a command SQL statement to select only relevant columns (aka don't export the sensitive columns where desired)
  • Auto-build the temp file and external log (to avoid bloat on Addin file directly).
  • Build cleanup for temp file and external log file (ACCDU).

This first PR is to build out others, create discussion, and have some review before we go forth. I've implemented it here as a ridealong to demonstrate feasibility and speed impacts (in my testing, it did not impact speed of export or build at all) and provided a ton more information and time stamp detail than I had.

The log also allows us to set the log level and thus keep the log a lot cleaner when users don't need ultragranular detail. For instance, if you're troubleshooting an export, you can set the log to log everything, even Debug Tracing. If you're in production, and you just want to know if warnings or more happen, you set it to warning.

Let me know what you all think!

If this initial implementation looks ok, I will refactor the rest of the clsLog2 class into the new one, but wanted to start off by showing a proof of concept.

@joyfullservice @josef-poetzl @bclothier anyone else?

Version Control.accda.src/modules/modAPI.bas Show resolved Hide resolved
@hecon5
Copy link
Contributor Author

hecon5 commented Jul 14, 2025

@josef-poetzl I have this just about finished up; though, I'm having trouble getting Application.ExportXML to export the Addin's log. It seems that even if I do CodeProject.Application.ExportXML whatever project you're working on is exported, not the AddinLogs.

I did discover that the LogTable in the addin (when the addin is loaded as an addin) DOES keep the data from operation to operation, which is a neat thing, but I can't seem to get the thing exported correctly.

I even went so far as to use the RunInAddin but even then, it only seems to export the table from the exported file, not the addin log, and I am stuck.

@josef-poetzl
Copy link
Contributor

josef-poetzl commented Jul 14, 2025

Maybe use a querydef (in the FE) that accesses the table in the add-in?
select * from [Path to add-in].TabName
Or temporarily link the table in the FE.

The ADODB XML export is probably not an alternative, is it?

By the way: don't forget that the data is gone when you update the add-in.
Possibly write to an “add-in data” file instead of the add-in (Version Control.accdu).

@hecon5
Copy link
Contributor Author

hecon5 commented Jul 14, 2025

By the way: don't forget that the data is gone when you update the add-in.

Correct, it's actually desired; in actuality, I'm not sure I even wanted it to persist between sessions (to keep it lightweight), but that's another discussion. I don't know if we want the log to be muddied between different files being built/export, keeping the log to a single project is probably ok long term though.

Depending on how long it takes to import/[do operation]/export to project log it may end up being more efficient to simply keep a per-operation log like is done now.

The ADODB XML export is probably not an alternative, is it?

Hmm, I'll give that a shot; I was hoping to use a consistent XML export routine in case we ended up needing to sanitize it like we do with the tables; this gives the advantage of using the same XML parsing tools used by the addin for the built db and therefore a consistent XML look.

@hecon5
Copy link
Contributor Author

hecon5 commented Jul 14, 2025

Figured it out!

https://learn.microsoft.com/en-us/office/client-developer/access/desktop-database-reference/streams-and-persistence

was what I needed; it's also stupid fast; exporting about 900 records in a half second.

I'm going to tidy it up and push up the finished up code; this first version will export the log, clear out the log after each operation so it's not persisted (as is the case now).

If this works well I'll add some options to allow the log to be appended to the existing XML file or simply continue as-is (the current system).

If that works well, the next step will be to expose the new log class externally via the API (so that the pre/post called functions can log their state if desired).

@hecon5
Copy link
Contributor Author

hecon5 commented Jul 14, 2025

half a second

this is guestimation; I haven't timed it, I suspect it's faster than that, I just wanted to point out that this operation doesn't take any more time than the current log saving mechanism.

…any connected file. Also correct to clear out the correct log table.
@hecon5
Copy link
Contributor Author

hecon5 commented Jul 14, 2025

ooh, unintended upside: because this class now relies on a table in the addin, if you somehow crash the addin/MS Access the log table remains and it will export next time you run an operation. This has been nice when I've caused a bug and needed to force close but don't know what went wrong during the export.

@hecon5 hecon5 marked this pull request as ready for review October 2, 2025 19:34
@hecon5
Copy link
Contributor Author

hecon5 commented Oct 2, 2025

Alright! @josef-poetzl, @joyfullservice , @bclothier : This is ready for looksee!

Logs are now stored in a separate file; they are persisted and if Access crashes during an operation, the logs will be retained...probably.

I haven't deleted the old clsLog (yet), but clsLog2 is entirely rewritten.

Each operation has a specific key, and you should be able to set persistence or not of the logs in your options. If you build two things from the same computer at once, each Log from the specific operation SHOULD be loaded correctly and not interfere.

Take a look, let me know what you think; I think the ability to set separate levels and have them log/not log based on the level is pretty sick, personally.

@hecon5
Copy link
Contributor Author

hecon5 commented Oct 2, 2025

The new Options defaults:
image

@hecon5
Copy link
Contributor Author

hecon5 commented Oct 2, 2025

closes #673 too

@hecon5
Copy link
Contributor Author

hecon5 commented Oct 6, 2025

Any other comments/reviews @josef-poetzl @joyfullservice @bclothier ? IIRC if you started a review you have to complete it before I can see any comments.

@bclothier
Copy link
Contributor

No further comments from me. Looks good but I have not tested the functionality yet.

@hecon5
Copy link
Contributor Author

hecon5 commented Oct 6, 2025

Thanks @bclothier! hopefully it runs as well on your machine as it did on mine.

No further comments from me. Looks good but I have not tested the functionality yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.