AI_SQLScripts.log not created although Log to file is enabled - Advanced Installer Community
MGS
Posts: 128
Joined: Tue Oct 04, 2022 9:52 am

AI_SQLScripts.log not created although Log to file is enabled

Hello,

For me the AI_SQLScripts.log is not created although Log informations to file is enabled for the MS SQL Connection and I made sure that an SQL error occured. What can be wrong here?

First of all, it seems the option was renamed and is now called Log informations to file. I read here what the Log errors to file option does:
Log errors to file: If this option is enabled and an error occurs, a log file(AI_SQLScripts.log) containing the error message will be automatically generated by the installer in the user's Temp folder
I am not able to find this file in the "%TEMP%" folder after running my installation and generating an error in an SQL Query that is called via an Immediate 'Query SQL database for data' Custom Action.

Best regards,
Johannes
Last edited by MGS on Mon Dec 19, 2022 9:59 am, edited 1 time in total.
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: AI_SQLScripts.log not created although Log to file is enabled

Hello Johannes,

The "Log errors to file" option is meant for SQL Scripts only, not for queries, as the name of the log file would suggest.

Connection and all its scripts are verbose & Log errors to file

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MGS
Posts: 128
Joined: Tue Oct 04, 2022 9:52 am

Re: AI_SQLScripts.log not created although Log to file is enabled

Catalin wrote: ↑Fri Dec 16, 2022 11:03 am Hello Johannes,

The "Log errors to file" option is meant for SQL Scripts only, not for queries, as the name of the log file would suggest.

Connection and all its scripts are verbose & Log errors to file

Best regards,
Catalin
Hello Catalin,

The documentation is out of date as the name of the flag "Log errors to file" has changed meanwhile to "Log informations to file". And looking at the "Log informations to file" flag does not per se tell the user that SQL query errors/information are not logged. And if looking into the installer log, it tells me "OnSqlInstall: Evaluating SQL script: [CustomUserSQLQuery] for processing...". So you are referring to the SQL query as a SQL script, which is also not helpful in figuring out what is happening and what is not.
Also, it should not be the user's responsibility to figure out what a function is doing by looking at the log file name.

But regardless of the naming, is there any way to log the query information in a log file?

I am still trying to find a way to display the SQL errors in static text and not in the popup. My idea was to log the SQL information to a file, analyze it with Powershell, and then react to the error as I need. But if there is no way to log this information, then I'm afraid I'm out of ideas.

Best regards,
Johannes
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: AI_SQLScripts.log not created although Log to file is enabled

Hello Johannes,
But regardless of the naming, is there any way to log the query information in a log file?
I'm afraid not. The option is meant only for SQL Scripts - as these can actually modify the database and fail. Queries, on the other hand, as the name suggests, are used only to retrieve some information from the database.

I have already created a ticket so we can update our User Guide to mention the option is meant for SQL Scripts and to also replace the "Log errors to file" to "Log information to file".

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MGS
Posts: 128
Joined: Tue Oct 04, 2022 9:52 am

Re: AI_SQLScripts.log not created although Log to file is enabled

Hello Catalin,
Catalin wrote: ↑Tue Dec 20, 2022 11:54 am I'm afraid not. The option is meant only for SQL Scripts - as these can actually modify the database and fail. Queries, on the other hand, as the name suggests, are used only to retrieve some information from the database.
As you know, SQL queries can also fail - just try to execute a SQL query using an incorrect column name. Therefore, it is important to log this information/error as well to fix problems with queries quickly.
Catalin wrote: ↑Tue Dec 20, 2022 11:54 am I have already created a ticket so we can update our User Guide to mention the option is meant for SQL Scripts and to also replace the "Log errors to file" to "Log information to file".
Thanks, that will definitely help other users in the future.

Best regards,
Johannes
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: AI_SQLScripts.log not created although Log to file is enabled

You're always welcome, Johannes!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”