Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by v3n0mou5 · Jan 10, 2015 at 09:09 AM · c#phpwebsitedebug.log

Debug log to website.

im trying to make it so that when i make apps or something that is build. it sends it debug log to a website. i have my own webspace so i can use php and stuff.

just a blank page that only shows my debug.logs.

i know its possible because i have seen it before, dont know where.

if you guys could help me that would be amazing.

so i call debug.log function or a function that puts it in a string or so.

sends to my website blank page.

and just add new line when new debug.log is send

thanks in advance :D

-v3

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HYPERSAVV · Jan 10, 2015 at 09:29 AM 0
Share

Write a customer logger that follows this (HTTP request with POST) to your domain, then take the POST data and copy it to a DB of some sort.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ByteSheep · Jan 10, 2015 at 10:13 AM

PHP Stuff

Check out the php function file_put_contents to write data to a file.

Example Usage:

 <?php
 
 $data = $_POST["debugdata"];
 
 if(isset($data))
 {
    $file = 'debuglog.txt';
    
    // Write the contents to the file
    file_put_contents($file, $data);
 }
 
 ?>

Unity Stuff

You'll want to look into sending post requests to a url using the www class and create a function with which you can easily add new debug statements. Check here for a way to extend Debug.Log.

Example (Add this to a gameobject in your scene):

 using UnityEngine;
 using System.Text;
 using System.Collections;
 
 public class DebugData : MonoBehaviour
 {
     public static DebugData Instance;
 
     private StringBuilder sb = new StringBuilder();
 
 
     void Awake ()
     {
         Instance = this;
     }
     
     public void AddDebug (string log)
     {
         sb.Append(log);
         sb.Append("\n");
     }
 
     public void PostDebugData ()
     {
         StartCoroutine(Post(sb.ToString()));
     }
 
     public IEnumerator Post (string data)
     {
         string url = "http://yoururl.com/yourdebugfile.php";
 
         // Create a Web Form
         var form = new WWWForm();
         form.AddField("debugdata", data);
 
         WWW w = new WWW(url, form);
         yield return w;
 
         if (!string.IsNullOrEmpty(w.error))
             print(w.error);
         else
             print("Finished sending debug data.");
     }
 }

Then you can add debug logs using DebugData.Instance.AddDebug("Hello World!"); and post the data using DebugData.Instance.PostDebugData();

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by hypnoticmeteor · Jan 10, 2015 at 10:19 AM

Create a table on your website called "Log" with 2 columns "ID" Primary Key and "LogString" as varchar.

Your application will use WWW class and WWWForms.

 string Debug_URL = "http://www.url_to_use_with_http";
     IEnumerator logData(string logStringToSendToWebServer)
     {
         WWWForm form = new WWWForm();
         form.AddField("logString",logStringToSendToWebServer);
         WWW get = new WWW(Debug_URL,form);
         yield return get;
         if (get.text == "done")
         {
             //finish code
         }
         else
         { 
             //fail recovery code
         }
     }

You php code should be something like this.

 #Connect to the database
 #check validation of some sort
 
 #Take data
 $logValueToEnterIntoDatabase = $_POST["logString"];
 
 #insert data into database by changing the value to be added as $logValueToEnterIntoDatabase
 
 

 
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Download HTML source code from link not working 1 Answer

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

WebHosting with phpMyAdmin PHP 0 Answers

App gets stuck on WebGL 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges