I have developed a web project. Which is generating log file using log4j. But the same application is deployed in UNIX, it is not able to create log file also..
I'm new to unix. Why it is not creating log file?
This is the code....
log4j.rootLogger = INFO,CA, FA
#Console Appender
log4j.appender.CA = org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout = org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern = %d %5p %c{1}:%L - %m%n
#File Appender
log4j.appender.FA = org.apache.log4j.FileAppender
log4j.appender.FA.File =correspondence.log
log4j.appender.FA.layout = org.apache.log4j.PatternLayout
log4j.appender.FA.layout.ConversionPattern = %d %5p [%t] - %m%n
It is creating log file in server installation folder. But not creating in UNIX.. Any changes I have to do?
try changing the line:
log4j.appender.FA.File =correspondence.log
to:
log4j.appender.FA.File = /tmp/correspondence.log
If it works, then create a log dir in the home directory of the user running the application server, chmod it at least to be executable and writable by owner and then put the log in that directory.
Related
I know how to copy a file in sftp server. But, how to put files in a sftp folder to a suitescript array? Also, is it possible to move or delete a file in sftp server using suite script 2.0? If yes, how to do it?
The following coding is for copying a file in sftp:
var myPwdGuid = "B34672495064525E5D65032D63B52301";
var myHostKey = "AAA1234567890Q=";
var connection = sftp.createConnection({
username: 'myuser',
passwordGuid: myPwdGuid,
url: 'host.somewhere.com',
directory: 'myuser/wheres/my/file',
hostKey: myHostKey
});
var downloadedFile = connection.download({
directory: 'relative/path/to/file',
filename: 'downloadMe.js'
});
connection.upload({
directory: 'relative/path/to/remote/dir',
filename: 'copy_of_downloadme.js',
file: downloadedFile,
replaceExisting: true
});
Indeed, the SFTP module in its current version does not include a way to list the contents of a remote directory. In some scenarios the file name is known or predictable. For the other scenarios one can use a file with a known name to store the names of the other files or middleware to retrieve the list of files. Ask me if you want to know about an existing middleware solution.
I have created log4j properties file within resource folder.Here is my log4j properties file code.
# LOG4J configuration
log4j.rootLogger = INFO, Appender1, Appender2
log4j.appender.Appender1 = org.apache.log4j.ConsoleAppender
log4j.appender.Appender1.layout = org.apache.log4j.PatternLayout
log4j.appender.Appender1.layout.ConversionPattern = %-7p %d [%t] %c %x - %m%n
log4j.appender.Appender2 = org.apache.log4j.FileAppender
log4j.appender.Appender2.File = C:/arnab/Logs/llllooooogggooo.log
log4j.appender.Appender2.layout = org.apache.log4j.PatternLayout
log4j.appender.Appender2.layout.ConversionPattern = %-7p %d [%t] %c %x - %m%n
but the problem is in my destination folder log4j file is not getting created. I am using JBoss server.I tried a lot but did not get any result. Can anyone help me pls?
The log4j.properties file should be placed in the proper classpath.
If you are using maven project, then it should be under, src/main/resources/. Make sure you have the following dependencies, available in the application classpath,
jboss-logmanager
jboss-logging
slf4j-log4j2
I've downloaded a website publish profile form Azure Portal. After importing the publish profile in Visual Studio I can publish my website without providing credentials by clicking ProjectName > Publish.
Importing produced a series of files
xxxxx - FTP.pubxml
xxxxx - FTP.pubxml.user
xxxxx - FTP-publish.ps1
xxxxx - Web Deploy.pubxml
xxxxx - Web Deploy.pubxml.user
xxxxx - Web Deploy-publish.ps1
I'm wondering if I could use either of the powershell files in my simple deployment process.
When I tried to run xxxxx - Web Deploy-publish.ps1 i got an error:
ps1 : An error occurred during publish. Cannot bind argument to
parameter 'publishProperties' because it is null.
I guess I'm missing some parameters. Can somebody provide me with an example how to run it properly?
Here is a sample Powershell that you can use to deploy your Web App to Azure.
You need to set the Params and point to your publish settings to get the deploy password etc..
# How to run the script
# deploy-azure-website-devbox-webdeploy.ps1 -ProjectFile
# Define input parameters
Param(
[Parameter(Mandatory = $true)]
[String]$ProjectFile, # Point to the .csproj file of the project you want to deploy
[Switch]$Launch # Use this switch parameter if you want to launch a browser to show the website
)
# Begin - Actual script -----------------------------------------------------------------------------------------------------------------------------
# Set the output level to verbose and make the script stop on error
$VerbosePreference = "Continue"
$ErrorActionPreference = "Stop"
$scriptPath = Split-Path -parent $PSCommandPath
# Mark the start time of the script execution
$startTime = Get-Date
# Build and publish the project via web deploy package using msbuild.exe
Write-Verbose ("[Start] deploying to Windows Azure website {0}" -f $websiteName)
# Read from website-environment.xml to get the environment name
[Xml]$envXml = Get-Content ("{0}\website-environment.xml" -f $scriptPath)
$websiteName = $envXml.environment.name
# Read from the publish settings file to get the deploy password
$publishXmlFile = "{0}\{1}.pubxml" -f $scriptPath, $websiteName
[Xml]$xml = Get-Content ("{0}\{1}.publishsettings" -f $scriptPath, $websiteName)
$password = $xml.publishData.publishProfile.userPWD.get(0)
# Run MSBuild to publish the project
& "$env:windir\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" $ProjectFile `
/p:VisualStudioVersion=11.0 `
/p:DeployOnBuild=true `
/p:PublishProfile=$publishXmlFile `
/p:Password=$password
Write-Verbose ("[Finish] deploying to Windows Azure website {0}" -f $websiteName)
# Mark the finish time of the script execution
$finishTime = Get-Date
# Output the time consumed in seconds
Write-Output ("Total time used (seconds): {0}" -f ($finishTime - $startTime).TotalSeconds)
# Launch the browser to show the website
If ($Launch)
{
Show-AzureWebsite -Name $websiteName
}
# End - Actual script -------------------------------------------------------------------------------------------------------------------------------
I am using log4qt with RollingFileAppender in my QT application. Everytime I restart my application logs are not appended to the log file, the file is simply overwritten.
Below is my log4qt.properties file.
log4j.rootLogger = DEBUG, File
log4j.appender.File=org.apache.log4j.RollingFileAppender
log4j.appender.File.File=logs/log.out
log4j.appender.File.MaxFileSize=3072KB
log4j.appender.File.MaxBackupIndex=3
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d [%t] [%p] %m%n
I tried to add the append property log4j.appender.File.Append=true , but i got error Property 'append' does not exist.
By exploring the code, I myself figured out the property that needs to be configured for appending the logs to the file.
The correct property is:
log4j.appender.File.AppendFile=true
I have trouble getting it to copy file from src to destination.
var asMsg_path:String = fileRef.nativePath;
var origFileLoc:File = File.applicationDirectory.resolvePath(asMsg_path);
var newFileLoc:File = File.applicationDirectory.resolvePath("/java/"+asMsg);
launch an AIR app in debug mode. I need to copy a file from asMsg to the Java folder in the same location as the app.
origFileLoc.moveTo(newLocation:FileReference, overwrite:Boolean);