Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

LOGFILES

Hello,

I want to know how to schedule a task in the QCM so i can transfer the logfile resulted after the daily reload of an application from the application folder to another folder.

Cheers

1 Solution

Accepted Solutions
undergrinder
Valued Contributor II

Re: LOGFILES

Hi Riad,

So the script log file name contains the application id, with this id you can specify, to which application belongs it.

It contains a timestamp as well, so you can specify which one is the newest.

If I were you, I'll follow these steps:

  • Disable the standard mode in order to have ability to execute batch files
  • Create an application, that find and copy the associated log file with execute command (the command will be created dinamically through script).
  • Create an other task with this new application, chained to the original application (task event trigger)

G.

9 Replies
undergrinder
Valued Contributor II

Re: LOGFILES

Hi Riad,

Open QMC and select tasks. Click on the new task button at the bottom of screen.

The log files are in c:\ProgramData\Qlik\Log directory, every task create a script log, which is closely the same as you can see during a reload in Data Load Editor.

G.

Not applicable

Re: LOGFILES

Thanks for your answer

I can see the script you're talking about. My purpose is to create a file that contains this script every time a reload is done (a certain task is finished). and second step is to transfer this file from the folder whre it is created to another one that i will choose after

Do you have any clue ?

undergrinder
Valued Contributor II

Re: LOGFILES

Hi Riad,

So the script log file name contains the application id, with this id you can specify, to which application belongs it.

It contains a timestamp as well, so you can specify which one is the newest.

If I were you, I'll follow these steps:

  • Disable the standard mode in order to have ability to execute batch files
  • Create an application, that find and copy the associated log file with execute command (the command will be created dinamically through script).
  • Create an other task with this new application, chained to the original application (task event trigger)

G.

Not applicable

Re: LOGFILES

Thanks for your help. I agree with your method but i don't know hot to do the three steps you mentionned before. How can i know if the standard mod has already been disabled or not ? How can i create such an application, is it a qlikview application ?

I'm a little lost here..

undergrinder
Valued Contributor II

Re: LOGFILES

Hi Riad,

It would be a QlikSense application (we are talking about QlikSense right?)

  • Standard mode :Editing an engine ‒ Qlik Sense ‌ check at QMC, or try load data with absolute path. If it works with absolute path, the standard mode is disabled (it is enabled default).
  • Example for listing all files in a folder, you can add subfield function to get appid and timestamp:

sub FileList (Root)

      for each File in filelist (Root&'\*.*')

         LOAD

            '$(File)' as Name,

         autogenerate 1;

      next File

end sub

call FileList ('lib://MyData')

After you selected the newest log in script you can concatenate a command and execute:

Execute 'Copy (or xcopy, robocopy) ' & '$(Log file full path)' 'c:\Destination'

G.

undergrinder
Valued Contributor II

Re: LOGFILES

This was just a pseudo code, but I hope it can be help.

Do not forget the semicolon ; 

Execute 'Copy (or xcopy, robocopy) ' & '$(Log file full path)' 'c:\Destination' ;

Not applicable

Re: LOGFILES

Thanks for the details In fact it's a qlikview application, are the steps mentionned in your messages working for qlikview ?

undergrinder
Valued Contributor II

Re: LOGFILES

Hi Riad,

I am not experienced in QlikView, but I know there is Execute command as well,

maybe some steps will change due to QlikView.

G.

stantrolav
Contributor II

Re: LOGFILES

1. Trigger on end of reload in self-application, that run macro:

     Sub RunCMDComand

     CMDCommand = ActiveDocument.Variables("RunCMD").GetContent.String

     set objShell = CreateObject("WScript.Shell")

     objShell.run CMDCommand,0,true

     end sub

2. Make variable RunCMD like this:

     ='CMD /C MOVE ' & SubField(DocumentPath(), '.', 1) & '*.log ' & Replace(DocumentPath(), DocumentName(), 'Log')

3. Be alerted that you MUST CREATE FOLDER "Log" in the folder that .QVW is in.

Macro would run after App is reloaded in full-client app either by server.

Cheers and fo to HELL with batch files.