Hi
I am trying to write to log file but the formatting of string is not
properly aligned in log file result
The results looks some thing like this
OK move.xml Successful
OK AppUser_ifrUsers.asp Successful
Here i have hardcoded OK & Successfull but the file name "move.XML" and
"AppUser_ifrUsers.asp" are obtained at when application is running.
The format expected is
OK move.xml Successful
OK AppUser_ifrUsers.asp Successful
Please can some one help me out regarding this..Its a bit irritating to
get like this
Thanks & Regards
Gopal 8 1758
gopal wrote:
Hi
I am trying to write to log file but the formatting of string is not
properly aligned in log file result
The results looks some thing like this
OK move.xml Successful
OK AppUser_ifrUsers.asp Successful
Here i have hardcoded OK & Successfull but the file name "move.XML" and
"AppUser_ifrUsers.asp" are obtained at when application is running.
The format expected is
OK move.xml Successful
OK AppUser_ifrUsers.asp Successful
Please can some one help me out regarding this..Its a bit irritating to
get like this
Thanks & Regards
Gopal
There are a few ways to do this, one way (just waking up so someone
jump in if there is a more elegant solution) could be:
private string LogLine (string logEntry)
{
string OK = "OK";
string SUCCESSFUL = "Successful";
string line = String.Format ("{0} {1, -30} {2}", OK, logEntry,
SUCCESSFUL);
return line;
}
Example call:
string line = LogLine ("Test log entry");
The format specifier {1, -30} will pad the second string (logEntry)
with 30 characters.
On my blog I link to thiis excellent summary of string formatters: http://idunno.org/displayBlog.aspx/2004071401
Best,
Nick http://seecharp.blogspot.com/
Nick
Thats Excellent.. Nice Day..
nick_nw wrote:
gopal wrote:
Hi
I am trying to write to log file but the formatting of string is not
properly aligned in log file result
The results looks some thing like this
OK move.xml Successful
OK AppUser_ifrUsers.asp Successful
Here i have hardcoded OK & Successfull but the file name "move.XML" and
"AppUser_ifrUsers.asp" are obtained at when application is running.
The format expected is
OK move.xml Successful
OK AppUser_ifrUsers.asp Successful
Please can some one help me out regarding this..Its a bit irritating to
get like this
Thanks & Regards
Gopal
There are a few ways to do this, one way (just waking up so someone
jump in if there is a more elegant solution) could be:
private string LogLine (string logEntry)
{
string OK = "OK";
string SUCCESSFUL = "Successful";
string line = String.Format ("{0} {1, -30} {2}", OK, logEntry,
SUCCESSFUL);
return line;
}
Example call:
string line = LogLine ("Test log entry");
The format specifier {1, -30} will pad the second string (logEntry)
with 30 characters.
On my blog I link to thiis excellent summary of string formatters:
http://idunno.org/displayBlog.aspx/2004071401
Best,
Nick http://seecharp.blogspot.com/
Hi Nick
The proble has been solved except for the issue that wherever i am
using this format, i keep changing the alignment wherever i am loggin
the contants
Example at one place i am calling
strLogContent = String.Format ("{0,-22} {1, -30} {2}", STR_FAILED,
strMoveXMLFileName,
STR_LOG_FAILED);
At another place i am calling the with different alignment as
strLogContent = String.Format ("{0,-20} {1, -35} {2}", STR_FAILED,
strMoveXMLFileName,
STR_LOG_FAILED);
So should i then keep changin the alignment or can we have fixed
alignment.
I would really appreciate if you can help me solve this issue
Regards
JP
gopal wrote:
Nick
Thats Excellent.. Nice Day..
nick_nw wrote:
gopal wrote:
Hi
>
I am trying to write to log file but the formatting of string is not
properly aligned in log file result
>
The results looks some thing like this
>
OK move.xml Successful
OK AppUser_ifrUsers.asp Successful
>
Here i have hardcoded OK & Successfull but the file name "move.XML" and
"AppUser_ifrUsers.asp" are obtained at when application is running.
The format expected is
>
OK move.xml Successful
OK AppUser_ifrUsers.asp Successful
>
Please can some one help me out regarding this..Its a bit irritating to
get like this
>
>
Thanks & Regards
Gopal
There are a few ways to do this, one way (just waking up so someone
jump in if there is a more elegant solution) could be:
private string LogLine (string logEntry)
{
string OK = "OK";
string SUCCESSFUL = "Successful";
string line = String.Format ("{0} {1, -30} {2}", OK, logEntry,
SUCCESSFUL);
return line;
}
Example call:
string line = LogLine ("Test log entry");
The format specifier {1, -30} will pad the second string (logEntry)
with 30 characters.
On my blog I link to thiis excellent summary of string formatters: http://idunno.org/displayBlog.aspx/2004071401
Best,
Nick http://seecharp.blogspot.com/
What is the problem? You get exactly the formatting that you specify. If
you don't like the formatting, change it.
gopal wrote:
Hi Nick
The proble has been solved except for the issue that wherever i am
using this format, i keep changing the alignment wherever i am loggin
the contants
Example at one place i am calling
strLogContent = String.Format ("{0,-22} {1, -30} {2}", STR_FAILED,
strMoveXMLFileName,
STR_LOG_FAILED);
At another place i am calling the with different alignment as
strLogContent = String.Format ("{0,-20} {1, -35} {2}", STR_FAILED,
strMoveXMLFileName,
STR_LOG_FAILED);
So should i then keep changin the alignment or can we have fixed
alignment.
I would really appreciate if you can help me solve this issue
Regards
JP
gopal wrote:
>Nick
Thats Excellent.. Nice Day..
nick_nw wrote:
>>gopal wrote: Hi
I am trying to write to log file but the formatting of string is not properly aligned in log file result
The results looks some thing like this
OK move.xml Successful OK AppUser_ifrUsers.asp Successful
Here i have hardcoded OK & Successfull but the file name "move.XML" and "AppUser_ifrUsers.asp" are obtained at when application is running. The format expected is
OK move.xml Successful OK AppUser_ifrUsers.asp Successful
Please can some one help me out regarding this..Its a bit irritating to get like this
Thanks & Regards Gopal There are a few ways to do this, one way (just waking up so someone jump in if there is a more elegant solution) could be:
private string LogLine (string logEntry) { string OK = "OK"; string SUCCESSFUL = "Successful"; string line = String.Format ("{0} {1, -30} {2}", OK, logEntry, SUCCESSFUL);
return line; }
Example call:
string line = LogLine ("Test log entry");
The format specifier {1, -30} will pad the second string (logEntry) with 30 characters.
On my blog I link to thiis excellent summary of string formatters:
http://idunno.org/displayBlog.aspx/2004071401
Best,
Nick http://seecharp.blogspot.com/
I want the formatting to be same for all the Log file i am goin to list
Example
OK move.xml Successful ----
alignment/formatting is different
Failed AppUser_ifrUsers.asp Successful ----- align/formating
is different
Can t i have the same format/alignment at all places where i am logging
to file
Göran Andersson wrote:
What is the problem? You get exactly the formatting that you specify. If
you don't like the formatting, change it.
gopal wrote:
Hi Nick
The proble has been solved except for the issue that wherever i am
using this format, i keep changing the alignment wherever i am loggin
the contants
Example at one place i am calling
strLogContent = String.Format ("{0,-22} {1, -30} {2}", STR_FAILED,
strMoveXMLFileName,
STR_LOG_FAILED);
At another place i am calling the with different alignment as
strLogContent = String.Format ("{0,-20} {1, -35} {2}", STR_FAILED,
strMoveXMLFileName,
STR_LOG_FAILED);
So should i then keep changin the alignment or can we have fixed
alignment.
I would really appreciate if you can help me solve this issue
Regards
JP
gopal wrote:
Nick
Thats Excellent.. Nice Day..
nick_nw wrote: gopal wrote: Hi
I am trying to write to log file but the formatting of string is not properly aligned in log file result
The results looks some thing like this
OK move.xml Successful OK AppUser_ifrUsers.asp Successful
Here i have hardcoded OK & Successfull but the file name "move.XML" and "AppUser_ifrUsers.asp" are obtained at when application is running. The format expected is
OK move.xml Successful OK AppUser_ifrUsers.asp Successful
Please can some one help me out regarding this..Its a bit irritatingto get like this
Thanks & Regards Gopal There are a few ways to do this, one way (just waking up so someone jump in if there is a more elegant solution) could be:
private string LogLine (string logEntry) { string OK = "OK"; string SUCCESSFUL = "Successful"; string line = String.Format ("{0} {1, -30} {2}", OK, logEntry, SUCCESSFUL);
return line; }
Example call:
string line = LogLine ("Test log entry");
The format specifier {1, -30} will pad the second string (logEntry) with 30 characters.
On my blog I link to thiis excellent summary of string formatters:
http://idunno.org/displayBlog.aspx/2004071401
Best,
Nick http://seecharp.blogspot.com/
Of course you can. Why wouldn't you?
gopal wrote:
I want the formatting to be same for all the Log file i am goin to list
Example
OK move.xml Successful ----
alignment/formatting is different
Failed AppUser_ifrUsers.asp Successful ----- align/formating
is different
Can t i have the same format/alignment at all places where i am logging
to file
Göran Andersson wrote:
>What is the problem? You get exactly the formatting that you specify. If you don't like the formatting, change it.
gopal wrote:
>>Hi Nick
The proble has been solved except for the issue that wherever i am using this format, i keep changing the alignment wherever i am loggin the contants
Example at one place i am calling
strLogContent = String.Format ("{0,-22} {1, -30} {2}", STR_FAILED, strMoveXMLFileName, STR_LOG_FAILED);
At another place i am calling the with different alignment as
strLogContent = String.Format ("{0,-20} {1, -35} {2}", STR_FAILED, strMoveXMLFileName, STR_LOG_FAILED);
So should i then keep changin the alignment or can we have fixed alignment.
I would really appreciate if you can help me solve this issue
Regards JP
gopal wrote: Nick
Thats Excellent.. Nice Day..
nick_nw wrote: gopal wrote: >Hi >> >I am trying to write to log file but the formatting of string is not >properly aligned in log file result >> >The results looks some thing like this >> >OK move.xml Successful >OK AppUser_ifrUsers.asp Successful >> >Here i have hardcoded OK & Successfull but the file name "move.XML" and > "AppUser_ifrUsers.asp" are obtained at when application is running. >The format expected is >> >OK move.xml Successful >OK AppUser_ifrUsers.asp Successful >> >Please can some one help me out regarding this..Its a bit irritating to >get like this >> >> >Thanks & Regards >Gopal There are a few ways to do this, one way (just waking up so someone jump in if there is a more elegant solution) could be: > > private string LogLine (string logEntry) { string OK = "OK"; string SUCCESSFUL = "Successful"; string line = String.Format ("{0} {1, -30} {2}", OK, logEntry, SUCCESSFUL); > return line; } > Example call: > string line = LogLine ("Test log entry"); > The format specifier {1, -30} will pad the second string (logEntry) with 30 characters. > On my blog I link to thiis excellent summary of string formatters: > http://idunno.org/displayBlog.aspx/2004071401 > Best, > Nick http://seecharp.blogspot.com/
Hi,
Please can you show/help me how sane alignment/format can be
used/applied for writing the log files. Would really apprecuate this.
Regards
JP
Göran Andersson wrote:
Of course you can. Why wouldn't you?
gopal wrote:
I want the formatting to be same for all the Log file i am goin to list
Example
OK move.xml Successful ----
alignment/formatting is different
Failed AppUser_ifrUsers.asp Successful ----- align/formating
is different
Can t i have the same format/alignment at all places where i am logging
to file
Göran Andersson wrote:
What is the problem? You get exactly the formatting that you specify. If
you don't like the formatting, change it.
gopal wrote: Hi Nick
The proble has been solved except for the issue that wherever i am using this format, i keep changing the alignment wherever i am loggin the contants
Example at one place i am calling
strLogContent = String.Format ("{0,-22} {1, -30} {2}", STR_FAILED, strMoveXMLFileName, STR_LOG_FAILED);
At another place i am calling the with different alignment as
strLogContent = String.Format ("{0,-20} {1, -35} {2}", STR_FAILED, strMoveXMLFileName, STR_LOG_FAILED);
So should i then keep changin the alignment or can we have fixed alignment.
I would really appreciate if you can help me solve this issue
Regards JP
gopal wrote: Nick
Thats Excellent.. Nice Day..
nick_nw wrote: gopal wrote: Hi > I am trying to write to log file but the formatting of string is not properly aligned in log file result > The results looks some thing like this > OK move.xml Successful OK AppUser_ifrUsers.asp Successful > Here i have hardcoded OK & Successfull but the file name "move.XML" and "AppUser_ifrUsers.asp" are obtained at when application is running. The format expected is > OK move.xml Successful OK AppUser_ifrUsers.asp Successful > Please can some one help me out regarding this..Its a bit irritating to get like this > > Thanks & Regards Gopal There are a few ways to do this, one way (just waking up so someone jump in if there is a more elegant solution) could be:
private string LogLine (string logEntry) { string OK = "OK"; string SUCCESSFUL = "Successful"; string line = String.Format ("{0} {1, -30} {2}", OK, logEntry, SUCCESSFUL);
return line; }
Example call:
string line = LogLine ("Test log entry");
The format specifier {1, -30} will pad the second string (logEntry) with 30 characters.
On my blog I link to thiis excellent summary of string formatters:
http://idunno.org/displayBlog.aspx/2004071401
Best,
Nick http://seecharp.blogspot.com/
Put the formatting string in a constant, and use the constant in the
formatting statements.
gopal wrote:
Hi,
Please can you show/help me how sane alignment/format can be
used/applied for writing the log files. Would really apprecuate this.
Regards
JP
Göran Andersson wrote:
>Of course you can. Why wouldn't you?
gopal wrote:
>>I want the formatting to be same for all the Log file i am goin to list
Example
OK move.xml Successful ---- alignment/formatting is different Failed AppUser_ifrUsers.asp Successful ----- align/formating is different
Can t i have the same format/alignment at all places where i am logging to file
Göran Andersson wrote: What is the problem? You get exactly the formatting that you specify. If you don't like the formatting, change it.
gopal wrote: Hi Nick > The proble has been solved except for the issue that wherever i am using this format, i keep changing the alignment wherever i am loggin the contants > Example at one place i am calling > > strLogContent = String.Format ("{0,-22} {1, -30} {2}", STR_FAILED, strMoveXMLFileName, STR_LOG_FAILED); > > At another place i am calling the with different alignment as > strLogContent = String.Format ("{0,-20} {1, -35} {2}", STR_FAILED, strMoveXMLFileName, STR_LOG_FAILED); > > So should i then keep changin the alignment or can we have fixed alignment. > I would really appreciate if you can help me solve this issue > Regards JP > gopal wrote: >Nick >> >Thats Excellent.. Nice Day.. >> >> >nick_nw wrote: >>gopal wrote: >>>Hi >>>> >>>I am trying to write to log file but the formatting of string is not >>>properly aligned in log file result >>>> >>>The results looks some thing like this >>>> >>>OK move.xml Successful >>>OK AppUser_ifrUsers.asp Successful >>>> >>>Here i have hardcoded OK & Successfull but the file name "move.XML" and >>> "AppUser_ifrUsers.asp" are obtained at when application is running. >>>The format expected is >>>> >>>OK move.xml Successful >>>OK AppUser_ifrUsers.asp Successful >>>> >>>Please can some one help me out regarding this..Its a bit irritating to >>>get like this >>>> >>>> >>>Thanks & Regards >>>Gopal >>There are a few ways to do this, one way (just waking up so someone >>jump in if there is a more elegant solution) could be: >>> >>> >>private string LogLine (string logEntry) >>{ >> string OK = "OK"; >> string SUCCESSFUL = "Successful"; >> string line = String.Format ("{0} {1, -30} {2}", OK, logEntry, >>SUCCESSFUL); >>> >> return line; >>} >>> >>Example call: >>> >>string line = LogLine ("Test log entry"); >>> >>The format specifier {1, -30} will pad the second string (logEntry) >>with 30 characters. >>> >>On my blog I link to thiis excellent summary of string formatters: >>> >>http://idunno.org/displayBlog.aspx/2004071401 >>> >>Best, >>> >>Nick >>http://seecharp.blogspot.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jouke Langhout |
last post by:
Hello all!
For quite some time now, I've got the following problem:
Access won't close properly when a user closes the application. An
ACCESS process stays active and that process can only be...
|
by: DBQueen |
last post by:
I have a subform which is in Continuous Forms view.
I have added a button to the bottom of the page to move to the next record
using the button wizard (result: DoCmd.GoToRecord , , acNext).
I...
|
by: Mike MacSween |
last post by:
tblCourses one to many to tblEvents.
A course may have an intro workshop (a type of event), a mid course
workshop, a final exam. Or any combination. Or something different in the
future.
At...
|
by: Sara |
last post by:
The problem:
Conditional formatting bold, red when field Value < date() sets the
field
background to white - always - whether condition is met or not. I
want the field unfilled and just red/bold...
|
by: Coleen |
last post by:
Hi all :-)
I have a weird formatting problem with an HTML table that I am populating using VB.Net and HTML.
Here is the snippet of code for the cell I'm trying to format:
Dim...
|
by: Typehigh |
last post by:
I have many text fields with conditional formatting applied,
specifically when the condition is "Field Has Focus". Without any
events associated with the fields the conditional formatting works...
|
by: Scott M. |
last post by:
Ok, this is driving me nuts...
I am using VS.NET 2003 and trying to take an item out of a row in a
loosely-typed dataset and place it in a label as a currency. As it is now,
I am getting my...
|
by: sara |
last post by:
Hi -
I have a report that is 14 columnar sub-reports (Line up: Position-
holders in each of our 14 locations - Manager, Assistant Manager,
Receiving, Office, etc).
I output directly to PDF...
|
by: Tomasz J |
last post by:
Hello developers,
I bind my TextBox control specyfying a format stored in my application
global ApplicationContext object - it has a static string CurrencyFormat
property.
The problem - this...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |