问题
I am new to SSIS, I have already designed a package and configured SSIS Log provider for Text Files. This works fine and log files are generated successfully.
We have a monitoring team, they use this log file for monitoring. They are unable to read the log files since the file encoding is in Unicode format. They are expecting a non unicode format for their monitoring.
I tried to change the existing log file encoding to ANSI but when I re-run the package my log file has been created again with UNICODE encoding.
Is any way we can create log files using SSIS Log provider for Text Files with non unicode encoding. Kindly suggest me any workaround. I am unable to find solution for the past two days.
回答1:
Trying to figure out the issue
Since SSIS Log provider for Text Files use a File connection manager for logging purposes, you don't have the choice to edit the file encoding within the SSIS package because this type of connection manager can be used for different files format (excel, text ...).
While searching for this issue it looks like if the log is created for the first time by SSIS it will write unicode data.
- why are my log files getting generated with a space between every two characters?
- Why is my SSIS text logfile formatted in this way?
Possible workaround
Try to create an empty text file using notepad and save it with ANSI encoding.
Then select this file from the SSIS logging configuration.
Other helpful links
- Change the default of encoding in Notepad
- Add Logging with SSIS
Update 1 - Experiments
To test the workaround i provided i have run the following experiments:
- I add SSIS Logging and created and a new log file
- After executing the package the file is create in Unicode (to check that i opened the file using notepad and click
Save As
the encoding shown in the combobox isUnicode
) - I create a new file using Notepad and save it using
Ansi
encoding as mentioned above. - In SSIS i changed the File connection manager to
Use Existing
instead ofCreate New
and i selected the file i created
- After executing the package the log is filled within the file and the encoding is still
Ansi
- I repeated executing the package several times and the undoing wont changes.
TL DR: Create a file with ANSI
encoding outside the ssis package and within the package create a file connection manager, select Use Existing
option and choose the created file. Use this file connection manager for logging purposes.
来源:https://stackoverflow.com/questions/55040423/change-the-file-encoding-of-the-file-which-is-created-using-ssis-log-provider-fo