필터 지우기
필터 지우기

Creating a runtime log for deployed application

조회 수: 57 (최근 30일)
Alexander Tye
Alexander Tye 2018년 2월 26일
댓글: Eric Delgado 2022년 9월 17일
I am using Application Compiler to create standalone versions of scripts. To debug, I would like to create a runtime log, but MATLAB does not appear to do so when I tick the box. Has anyone else had this problem?

답변 (1개)

Chandani Madnani
Chandani Madnani 2018년 3월 1일
편집: Chandani Madnani 2018년 3월 1일
Log file is created in the same folder when you execute exe from for_testing or for_redistribution_files folders.
If you are running from for_redistribution, the log files will not be created if the application launched does not have privileges to write files in the installation directory. For example, in operating systems like Windows 7, the application running with user privileges will not be allowed to create files under "C:\Program Files". If the deployed application is installed under the "C:\Program Files" or "C:\Program Files (x86)" path, please follow the workarounds mentioned below to generate log files from the application.
1. The application can be launched as administrator. For Windows 7 - Right click on the application executable or shortcut and click on "Run as administrator"
2. Install the application in a path where the user running the application has privileges to create files. For example, installing under the Path: "C:\Users\<user_name>"
  댓글 수: 5
Eleanor Betton
Eleanor Betton 2022년 6월 29일
I have the same poblem with log files on the desktop when the user checks the shortcut at install. If you manually create a shortcut afterwards it doesn't occur.
Eric Delgado
Eric Delgado 2022년 9월 17일
You have to map the PATH of your app (project, installed or deployed). You could create a property named "app.RootFolder" and put the lines of codes (below) in your Startup.
And... don't forget to point to the full path of files - fullfile(app.RootFolder, 'Subfolder', 'File.ext'), for example.
if isdeployed % Deployed version
[~, result] = system('path');
app.RootFolder = char(regexpi(result, 'Path=(.*?);', 'tokens', 'once'));
if ~isfile(fullfile(app.RootFolder, 'NameOfYourApp.exe'))
% ERROR
end
else
prjPath = matlab.project.rootProject;
appPath = fullfile(char(com.mathworks.appmanagement.MlappinstallUtil.getAppInstallationFolder), 'NameOfYourApp');
if ~isempty(prjPath) & strcmp(prjPath.Name, 'NameOfYourApp') % Project version
app.RootFolder = char(prjPath.RootFolder);
elseif isfolder(appPath) % Installed version
app.RootFolder = appPath;
else
% ERROR
end
end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Application Deployment에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by