database log file configuration..
-
I am a PeopleSoft developer/programmer for the last 20+ years with just enough information about databases. But I am curious to know a bit more about the logging features of databases. Let me be specific. Is it possible to congigure the log file to show select statements on a particular field no matter which table/view that fiels is a part of? Second question: if someone does a select * from any of the tables that this field is a part of, can we configure the log to show the exact select sql statement? Your throughts and replies in detail hightly appreciated. Thanks.
-
I am a PeopleSoft developer/programmer for the last 20+ years with just enough information about databases. But I am curious to know a bit more about the logging features of databases. Let me be specific. Is it possible to congigure the log file to show select statements on a particular field no matter which table/view that fiels is a part of? Second question: if someone does a select * from any of the tables that this field is a part of, can we configure the log to show the exact select sql statement? Your throughts and replies in detail hightly appreciated. Thanks.
-
I am a PeopleSoft developer/programmer for the last 20+ years with just enough information about databases. But I am curious to know a bit more about the logging features of databases. Let me be specific. Is it possible to congigure the log file to show select statements on a particular field no matter which table/view that fiels is a part of? Second question: if someone does a select * from any of the tables that this field is a part of, can we configure the log to show the exact select sql statement? Your throughts and replies in detail hightly appreciated. Thanks.
What you want is called "profiling" and is not used for logging but debugging. Should be easy on SQL Server. I would not use it for logging - usually a database has so many transactions that reading a logfile by yourself is not very productive. If the application is yours (and the only one accessing the db), then you can make a decorator for the IDbCommand and IDbConnection that wraps the existing commands and do the logging from there.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
What you want is called "profiling" and is not used for logging but debugging. Should be easy on SQL Server. I would not use it for logging - usually a database has so many transactions that reading a logfile by yourself is not very productive. If the application is yours (and the only one accessing the db), then you can make a decorator for the IDbCommand and IDbConnection that wraps the existing commands and do the logging from there.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
Hello "I appreciate your reply from Hell programmer", (just joking about the name, but serious about the appreciation part) Thank you for your reply; as of right now totally out of my league but gave me an impression that your response is on to something I am really looking for. Your profile gives me an impresison that you are more of a technology writer, blogger rather than a hard core geek/programmer. Am I totally wrong? You mentioned MS SQL is easy to do; but how about other databases like Oracle, Db2, MySqL, etc? Do you mind sharing your personal/work email? Much appreciated, thank you.
-
The answer is likely to be different for different database systems, so you most probably need to study the documentation for each one.
Thank you for your response. I appreciate it. I will try eventhough might be very hard for me with pretty much no experience on the DB level.
-
Hello "I appreciate your reply from Hell programmer", (just joking about the name, but serious about the appreciation part) Thank you for your reply; as of right now totally out of my league but gave me an impression that your response is on to something I am really looking for. Your profile gives me an impresison that you are more of a technology writer, blogger rather than a hard core geek/programmer. Am I totally wrong? You mentioned MS SQL is easy to do; but how about other databases like Oracle, Db2, MySqL, etc? Do you mind sharing your personal/work email? Much appreciated, thank you.
Member 13536030 wrote:
Am I totally wrong?
I don't have a blog, didn't write any book.
Member 13536030 wrote:
You mentioned MS SQL is easy to do; but how about other databases like Oracle, Db2, MySqL, etc?
For MSSQL, there is a profiler-application that is part of the enterprise-version; it'll show you any SQL command that is executed against the server. In Oracle they don't call it a profiler, but a trace; each large db-vendor has their specific tools. These tools have the advantage that they show everything that is communicating with your database. If you're going to use it for debugging, then you're only interested in the SQL that your application generates. In that case there are other tools that help, like MiniProfiler: A simple but effective mini-profiler for .NET and Ruby[^]. This requires a change in code, but does not depend on a specific type of database.
Member 13536030 wrote:
Do you mind sharing your personal/work email?
Yes. Any question can be asked and answered on the forum, for all to benefit. For you it has the added benefit that if I am wrong, someone will correct me :)
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
Member 13536030 wrote:
Am I totally wrong?
I don't have a blog, didn't write any book.
Member 13536030 wrote:
You mentioned MS SQL is easy to do; but how about other databases like Oracle, Db2, MySqL, etc?
For MSSQL, there is a profiler-application that is part of the enterprise-version; it'll show you any SQL command that is executed against the server. In Oracle they don't call it a profiler, but a trace; each large db-vendor has their specific tools. These tools have the advantage that they show everything that is communicating with your database. If you're going to use it for debugging, then you're only interested in the SQL that your application generates. In that case there are other tools that help, like MiniProfiler: A simple but effective mini-profiler for .NET and Ruby[^]. This requires a change in code, but does not depend on a specific type of database.
Member 13536030 wrote:
Do you mind sharing your personal/work email?
Yes. Any question can be asked and answered on the forum, for all to benefit. For you it has the added benefit that if I am wrong, someone will correct me :)
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
I am creating an application that will read log/profile files and parse it to find, anyalyse SQL queries (to start with only "select" statements) that are executed for a few particular fields and those tables/views that use these files. So for this application to work, the application should know the format of the file it reads. Let me see if I can be more specific: I have a field called 'field1' used by a table called 'table1'. I want to turn on / configure something in my MySQL database (it could the profiling) tool you mentioned with the goal that every night I can get a file that shows any "Select" statements against this field and table. Is that possible? Thanks.
-
I am creating an application that will read log/profile files and parse it to find, anyalyse SQL queries (to start with only "select" statements) that are executed for a few particular fields and those tables/views that use these files. So for this application to work, the application should know the format of the file it reads. Let me see if I can be more specific: I have a field called 'field1' used by a table called 'table1'. I want to turn on / configure something in my MySQL database (it could the profiling) tool you mentioned with the goal that every night I can get a file that shows any "Select" statements against this field and table. Is that possible? Thanks.
-
I am a PeopleSoft developer/programmer for the last 20+ years with just enough information about databases. But I am curious to know a bit more about the logging features of databases. Let me be specific. Is it possible to congigure the log file to show select statements on a particular field no matter which table/view that fiels is a part of? Second question: if someone does a select * from any of the tables that this field is a part of, can we configure the log to show the exact select sql statement? Your throughts and replies in detail hightly appreciated. Thanks.
Based on other responses. So database is MySQL and you want to look at what statements were used. From that you want "General query log" MySQL :: MySQL 5.7 Reference Manual :: 5.4 MySQL Server Logs[^] However be very careful if you are using this on a production machine. You want to insure that the log files do not use up the entire file system.
Member 13536030 wrote:
if someone does a select * from any of the tables
Just noting that is a bad idea. Shouldn't be allowed. Hinders maintenance work and things like exactly what you are doing. However you can't tell whether the client is using a specific column or not even if it was specified. But if "*" is used then you will know for a fact it is being returned.